These are chat archives for kbknapp/clap-rs

5th
Apr 2019
cedricdaf
@cedricdaf
Apr 05 07:57

Hi, I have a question, regarding subcommand args requirement:

I'm trying to figure out how to have a subcommand that doesn't requires my main args, while another one do. Basically, I can disable the requirement for all subcommands with .setting(AppSettings::SubcommandsNegateReqs)
But this is not what I want. I kinda want to be able to have the same functionality as the help subcommand (which doesn't requires the main args)
Is that possible ?

So something like that:

my_app help => display help
my_app examples => display examples
my_app -i input => app without a mode, requires -i
my_app -i input mode -a with_value => mode should fail if no -i arg

Cheers.