Skip to content

Commit 8031823

Browse files
committed
Optimized command validation
1 parent 61507dd commit 8031823

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/command-core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,7 @@ export const command = <
325325
>(command: RawCommand<TOpts, TOptsData, TTransformed>): Command<TOptsData, Awaited<TTransformed>> => {
326326
const allNames = command.aliases ? [command.name, ...command.aliases] : [command.name];
327327

328-
const processedOptions = command.options ? validateOptions(command.options) : undefined;
329328
const cmd: Command = clone(command) as any;
330-
331329
if (
332330
(<AnyRawCommand> command).subcommands && command.options
333331
&& Object.values(command.options).find((opt) => opt._.config.type === 'positional')
@@ -336,6 +334,8 @@ export const command = <
336334
`Can't define command '${cmd.name}' - command can't have subcommands and positional args at the same time!`,
337335
);
338336
}
337+
338+
const processedOptions = command.options ? validateOptions(command.options) : undefined;
339339
cmd.options = processedOptions;
340340

341341
cmd.name = cmd.name ?? cmd.aliases?.shift();

0 commit comments

Comments
 (0)