Skip to content

Commit 47398f1

Browse files
committed
fix: remove sub-command name when resolving nested
1 parent 267d9ea commit 47398f1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/args.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function parseArgs(rawArgs: string[], argsDef: ArgsDef): ParsedArgs {
2727
}
2828

2929
const parsed = parseRawArgs(rawArgs, parseOptions);
30-
const [, ...positionalArguments] = parsed._;
30+
const [...positionalArguments] = parsed._;
3131

3232
const parsedArgsProxy = new Proxy(parsed, {
3333
get(target: ParsedArgs<any>, prop: string) {

src/command.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export async function runCommand(
5353
const subCommand = await resolveValue(subCommands[subCommandName]);
5454
if (subCommand) {
5555
await runCommand(subCommand, {
56-
rawArgs: opts.rawArgs.slice(subCommandArgIndex),
56+
rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1),
5757
});
5858
}
5959
}
@@ -77,7 +77,7 @@ export async function resolveSubCommand(
7777
if (subCommand) {
7878
return resolveSubCommand(
7979
subCommand,
80-
rawArgs.slice(subCommandArgIndex),
80+
rawArgs.slice(subCommandArgIndex + 1),
8181
cmd
8282
);
8383
}

0 commit comments

Comments
 (0)