You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I define options as global (either via .globalOption or .option(..., {global: true}) they just apply/are global to the last command that was defined.
If I use .reset() after every command, I can define truly global options again.
Is this a bug or by design? If it is by design, you could maybe add disclaimer to the docs what "global" means, or that one should use .reset() every so often.
The text was updated successfully, but these errors were encountered:
This is working as expected. The command class is a chainable command factory. Adding an option after adding a new command with the command method, will register the option on the new sub command instead of the main command.
newCommand()// Add option to main command:.option('-f, --foo','...')// Add sub command.command('foo')// Add option to foo command:.option('-b, --bar','...')
If I define options as global (either via
.globalOption
or.option(..., {global: true})
they just apply/are global to the last command that was defined.If I use
.reset()
after every command, I can define truly global options again.Please see this gist and the comment on it for an example and it's output: https://gist.github.com/krlwlfrt/e6e60117ef0e1e41d1dbbf7042928789
Is this a bug or by design? If it is by design, you could maybe add disclaimer to the docs what "global" means, or that one should use
.reset()
every so often.The text was updated successfully, but these errors were encountered: