Mercurial > hg > configuration
annotate 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 |
rev | line source |
---|---|
139 | 1 #!/usr/bin/env python |
2 | |
3 """ | |
4 illustrate which options are parsed with argparse | |
5 """ | |
6 | |
7 import argparse | |
8 import sys | |
9 | |
10 class UndefinedArgumentParser(argparse.ArgumentParser) | |
11 | |
12 def main(args=sys.argv[1:]): | |
13 | |
14 parser = UndefinedArgumentParser() | |
15 parser.add_argument('--foo', dest='foo', | |
16 help="foo") | |
17 | |
18 if __name__ == '__main__': | |
19 main() |