Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #197575
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "Loris Bennett" <loris.bennett@fu-berlin.de> |
| Newsgroups | comp.lang.python |
| Subject | argsparse: allowing --version without mandatory options |
| Date | Thu, 30 Oct 2025 11:12:28 +0100 |
| Organization | FUB-IT, Freie Universität Berlin |
| Lines | 16 |
| Message-ID | <87bjlod7g3.fsf@zedat.fu-berlin.de> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| X-Trace | news.uni-berlin.de v2NStmPRey8S/vtXnR3jtwFbBrAooyzJX4ftDKgIMV48Bt |
| Cancel-Lock | sha1:pMhi8ioYeEZf20JWVXIvy7RohQs= sha1:xda5gbhmH9ITTmUIVTXdfB8D2AQ= sha256:5bKjY/+Hm0QgJTsRZflHT5dbNDE8Fi/TpQlq1hFufTY= |
| User-Agent | Gnus/5.13 (Gnus v5.13) |
| Xref | csiph.com comp.lang.python:197575 |
Show key headers only | View raw
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.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar
argsparse: allowing --version without mandatory options "Loris Bennett" <loris.bennett@fu-berlin.de> - 2025-10-30 11:12 +0100
Re: argsparse: allowing --version without mandatory options "Loris Bennett" <loris.bennett@fu-berlin.de> - 2025-10-30 13:50 +0100
Re: argsparse: allowing --version without mandatory options "Jonathan N. Little" <lws4art@gmail.com> - 2025-11-03 22:19 -0500
Re: argsparse: allowing --version without mandatory options Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-30 21:57 +0000
csiph-web