Skip to content

Commit 1df4338

Browse files
committed
feat: create options for excess args and unknown options for commands
1 parent 6fd3c87 commit 1df4338

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/nest-commander/src/command-runner.interface.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export interface CommandMetadata {
6060
options?: CommandOptions;
6161
subCommands?: Array<Type<CommandRunner>>;
6262
aliases?: string[];
63+
allowUnknownOptions?: boolean;
64+
allowExcessArgs?: boolean;
6365
}
6466

6567
export type RootCommandMetadata = Omit<CommandMetadata, 'name'> & {

packages/nest-commander/src/command-runner.service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ ${cliPluginError(
141141
if (this.options.helpConfiguration) {
142142
newCommand.configureHelp(this.options.helpConfiguration);
143143
}
144+
if (command.command.allowUnknownOptions) {
145+
newCommand.allowUnknownOption();
146+
}
147+
if (command.command.allowExcessArgs) {
148+
newCommand.allowExcessArguments();
149+
}
144150
if (command.command.arguments) {
145151
this.mapArgumentDescriptions(
146152
newCommand,

0 commit comments

Comments
 (0)