From 47398f1b288a5e816442add98c06b21362d9f076 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 31 Mar 2023 17:58:51 +0200 Subject: [PATCH] fix: remove sub-command name when resolving nested --- src/args.ts | 2 +- src/command.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/args.ts b/src/args.ts index 95a616f..d764cd9 100644 --- a/src/args.ts +++ b/src/args.ts @@ -27,7 +27,7 @@ export function parseArgs(rawArgs: string[], argsDef: ArgsDef): ParsedArgs { } const parsed = parseRawArgs(rawArgs, parseOptions); - const [, ...positionalArguments] = parsed._; + const [...positionalArguments] = parsed._; const parsedArgsProxy = new Proxy(parsed, { get(target: ParsedArgs, prop: string) { diff --git a/src/command.ts b/src/command.ts index 635976a..8777f83 100644 --- a/src/command.ts +++ b/src/command.ts @@ -53,7 +53,7 @@ export async function runCommand( const subCommand = await resolveValue(subCommands[subCommandName]); if (subCommand) { await runCommand(subCommand, { - rawArgs: opts.rawArgs.slice(subCommandArgIndex), + rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1), }); } } @@ -77,7 +77,7 @@ export async function resolveSubCommand( if (subCommand) { return resolveSubCommand( subCommand, - rawArgs.slice(subCommandArgIndex), + rawArgs.slice(subCommandArgIndex + 1), cmd ); }