subcommands can't have a --version option
See original GitHub issueA primary command can take a --version
option with the following code:
args.option('version', 'The version of the thing');
const flags = args.parse(process.argv, {
version: false,
});
When I run my-command my-subcommand --help
, I see
-v, --version The version of the thing
But when I run my-command my-subcommand --version=foo
, flags.version
is unpopulated.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
How to get options from sub command exes #563 - GitHub
In my 'foo' sub command file (Eg. pm-foo.js) how do I get hold of the options passed? pm.js: ... program .version('0.0.1') .command('foo ...
Read more >python - argparse solution requested for commands and ...
If a command is used, some sub-commands or options are required. I have a hard time getting this done using the argparse library....
Read more >Commands and Groups — Click Documentation (8.1.x)
Suppose we have a program called tool.py , containing a subcommand called sub . tool.py --help will return the help for the whole...
Read more >svn—Subversion Command-Line Client - SVN Book
While Subversion has different options for its subcommands, all options exist in a single namespace—that is, each option is guaranteed to mean the...
Read more >file — CMake 3.25.1 Documentation
If the ENCODING option is not provided and the file has a Byte Order Mark, the ENCODING option will be defaulted to respect...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I missed
in the readme. Nice!
@jamesarosen this is also possible with
args
. You can put your code in theinit
function like this:Then, the
init
function gets executed instead of running the binary for the subcommand.