Programatically added subcommands don't appear in help
See original GitHub issueWhen I add my commands like this:
subcommands = {
TransformCommand.class,
ValidateCommand.class
}
This shows the help as it should be:
Commands:
transform Transforms ...
validate Validates ...
However, when I add them like this:
commandLine.addSubcommand("transform", new TransformCommand());
commandLine.addSubcommand("validate", new ValidateCommand());
Nothing appears in help, and to make things very ackward, the commands actually work when I call them, they are just not appearing in the help.
Am I missing something?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
nested subcommands declared programatically not listed in ...
The intention is that the usage help prints all subcommands, regardless of whether they were added programmatically or declaratively.
Read more >python - In django, how do I call the subcommand 'syncdb ...
All Django management commands can be accessed programmatically: from django.core.management import call_command call_command('syncdb', ...
Read more >Programmatic API - Picocli
The subcommand method returns a different ParseResult object that can be used to query which options and positional parameters were matched for ...
Read more >django-admin and manage.py
Run django-admin help to display usage information and a list of the commands provided by each application. Run django-admin help --commands to display...
Read more >Tutorial: Get started with System.CommandLine
CommandLine package; Test the app; Add a subcommand and options ... --version Show version information -?, -h, --help Show help and usage ...
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 Free
Top 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
Glad to hear that!
By the way, since you are writing an application with subcommands you may be interested in the new
@ParentCommand
annotation that will be in the upcoming 2.2 release (hopefully end of this week).For details, see https://github.com/remkop/picocli/wiki/Manual-(2.2.0-SNAPSHOT)#code-parentcommand-code-annotation
Actually I found my mistake while writing it. I was passing
this
instead of the actual command line when printing the help. That is why only when added as annotation worked.Apologies for the unnecessary noise and THANKS! for the absolutely great piece of software. Would add a star now but already did!