• =?UTF-8?Q?argparse_=E2=80=94_adding_a_=2D=2Dversion_flag_in_the_face_of

    From Skip Montanaro@21:1/5 to All on Sun Nov 27 17:40:06 2022
    I have a script to which I'd like to add a --version flag. It should print
    the version number then exit, much in the same way --help prints the help
    text then exits. I haven't been able to figure that out. I always get a complaint about the required positional argument.

    I think I could use something like nargs='*', but that would push off
    detection of the presence of the positional arg to the application.
    Shouldn't I be able to tell argparse I'm going to process --verbose, then
    exit?

    Thx,

    Skip

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)