diff --git a/packages/core/src/command/index.ts b/packages/core/src/command/index.ts index 599b16b5a..7a072f142 100644 --- a/packages/core/src/command/index.ts +++ b/packages/core/src/command/index.ts @@ -315,8 +315,8 @@ export class Commander { if (!this.inferCommand(argv)) return if (argv.tokens?.every(token => !token.inters.length)) { const { options, args, error } = argv.command.parse(argv) - argv.options = { ...argv.options, ...options } - argv.args = [...argv.args || [], ...args] + argv.options = options + argv.args = args argv.error = error } return argv.command diff --git a/packages/core/src/command/parser.ts b/packages/core/src/command/parser.ts index 31303ddfb..44c9f0421 100644 --- a/packages/core/src/command/parser.ts +++ b/packages/core/src/command/parser.ts @@ -373,7 +373,7 @@ export namespace Argv { if (typeof argv === 'string') { argv = Argv.parse(argv, terminator) } - const args = argv.args || [] + const args = [...argv.args || []] const options = { ...argv.options } if (!argv.source && argv.tokens) {