Re: argsparse: allowing --version without mandatory options

2025-10-30 Thread 2QdxY4RzWzUUiLuE
On 2025-10-30 at 13:50:42 +0100, Loris Bennett wrote: > "Loris Bennett" writes: > > 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' (whic

Re: argsparse: allowing --version without mandatory options

2025-10-30 Thread Loris Bennett
"Loris Bennett" writes: > 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 m

argsparse: allowing --version without mandatory options

2025-10-30 Thread Loris Bennett
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 the

Re: argsparse: allowing --version without mandatory options

2025-10-30 Thread Mats Wichmann
On 10/30/25 11:47, [email protected] wrote: On 2025-10-30 at 13:50:42 +0100, Don't take this the wrong way, but what, exactly, is a mandatory option? Perhaps an argument that must be given in order to specify a value that has no default (not that I'd do that, personally). O