Mercurial > hg > configuration
diff example/argparse_undefined.py @ 139:30abbd61ea5e
example
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 04 Nov 2014 15:56:54 -0800 |
parents | |
children | c6aea14a3e2b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/argparse_undefined.py Tue Nov 04 15:56:54 2014 -0800 @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +""" +illustrate which options are parsed with argparse +""" + +import argparse +import sys + +class UndefinedArgumentParser(argparse.ArgumentParser) + +def main(args=sys.argv[1:]): + + parser = UndefinedArgumentParser() + parser.add_argument('--foo', dest='foo', + help="foo") + +if __name__ == '__main__': + main()