argsparse: allowing --version without mandatory options
"Loris Bennett" <[email protected]> Thu, 30 Oct 2025 11:12:28 +0100
| Newsgroups | comp.lang.python |
|---|---|
| Organization | FUB-IT, Freie Universität Berlin |
| Message-ID | <[email protected]> |
Hi, I am writing a program for the command-line which uses 'argsparse'. I want to make some options mandatory by setting 'required=True', but still allow the program to run with the option '--version' (which just shows the version and then exits) even if the mandatory options are missing. Is there a standard way of doing this? Cheers, Loris -- This signature is currently under constuction.