-
It is common to have a flag like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I won't say it is common. "version" and "help" are somewhat common which is why they have special handlers to them. If you want to do something like that you can follow that structure with an exception that gets thrown and you handle it manually in your code. option_groups were meant to handle things like that but if you don't like the error output or help printing for that, the other option would be a custom callback for the flag and setting the trigger_on_parse flag so the callback is executed immediately. That callback can change the |
Beta Was this translation helpful? Give feedback.
I won't say it is common. "version" and "help" are somewhat common which is why they have special handlers to them. If you want to do something like that you can follow that structure with an exception that gets thrown and you handle it manually in your code.
option_groups were meant to handle things like that but if you don't like the error output or help printing for that, the other option would be a custom callback for the flag and setting the trigger_on_parse flag so the callback is executed immediately. That callback can change the
required
modifier on the other option.