Skip to content

Flags which override required options? #945

Answered by phlptp
trapexit asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by trapexit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants