On 2010-11-16 14:35:01 -0500, Neal Becker said:
I want to have subparsers, but I also want to be able to say:
myprogram --version
and get the version #
Would it not be possible to print the version number and then exit the
program before building the subparser?
---
On Tue, 16 Nov 2010, Neal Becker wrote:
> I want to have subparsers, but I also want to be able to say:
>
> myprogram --version
> and get the version #
>
> ---
[...]
AFAIK, it is not possible ATM to have optional subparsers with argparse:
http://code.google.com/p/argpar
I want to have subparsers, but I also want to be able to say:
myprogram --version
and get the version #
---
import argparse
def stop():
pass
parser = argparse.ArgumentParser()
parser.add_argument ('--version', action='store_true')
subparsers = parser.add_subparsers