Skip to content

Commit 0447b96

Browse files
committed
Update code documentation
Document why it's not possible to support interactive options for the root command when no subcommand is invoked.
1 parent 2022666 commit 0447b96

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/interactive-command.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ export class InteractiveCommand extends Command {
111111
this._providedOptionsSources = providedOptionsSources;
112112
} catch {}
113113

114+
// Even if we prompt for the missing options of the root command here, there
115+
// is no easy way to feed them into super.parseAsync. Therefore, interactive
116+
// options are not supported on the root command when no subcommand is
117+
// invoked. This is a limitation of Commander.js. The only supported hook
118+
// is "preSubcommand" which is called after parsing argv and before calling
119+
// the subcommand's action.
120+
114121
return super.parseAsync(argv, options);
115122
}
116123

0 commit comments

Comments
 (0)