Skip to content

Commit

Permalink
feat(usage): resolve sub commands for meta description (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
zuixinwang authored Jun 18, 2023
1 parent 1b57ba3 commit 0d0d2ec
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ export async function renderUsage<T extends ArgsDef = ArgsDef>(

if (cmd.subCommands) {
const commandNames: string[] = [];
for (const [name, sub] of Object.entries(cmd.subCommands)) {
commandsLines.push([name, sub.meta?.description || ""]);
const subCommands = await resolveValue(cmd.subCommands);
for (const [name, sub] of Object.entries(subCommands)) {
const subCmd = await resolveValue(sub);
const meta = await resolveValue(subCmd?.meta);
commandsLines.push([name, meta?.description || ""]);
commandNames.push(name);
}
usageLine.push(commandNames.join("|"));
Expand Down

0 comments on commit 0d0d2ec

Please sign in to comment.