Created
November 26, 2015 13:58
-
-
Save msikma/50e9a0271dceb8d4e72e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
argparser = argparse.ArgumentParser(add_help=True) | |
argparser.description = 'Description.' | |
argparser.epilog = 'Epilog.' | |
argparser.add_argument('--version', action='version', version='1.0.0') | |
subparsers = argparser.add_subparsers( | |
title='Positional arguments', | |
dest='posarg' | |
) | |
test_arg_1 = subparsers.add_parser('c1', help='c1 help') | |
test_arg_1.add_argument('-f', '--foo', action='store', help='foo') | |
test_arg_2 = subparsers.add_parser('c2', aliases=['co'], help='c2 help') | |
test_arg_2.add_argument('-b', '--bar', action='store', type=int, help='bar') | |
args = argparser.parse_args() | |
print(repr(args)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment