Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
python-argparse-generate-manpages-example/frobnicate /
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
36 lines (23 sloc)
822 Bytes
This file contains 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/python2 | |
| r'''Frobnicates foos into bars | |
| Synopsis: | |
| $ frobnicate --param 5 a.foo > a.bar | |
| Done! | |
| This tool does things in some way. And here I describe just how it does it! | |
| ''' | |
| import argparse | |
| def parse_args(): | |
| parser = \ | |
| argparse.ArgumentParser(description = __doc__, | |
| formatter_class=argparse.RawDescriptionHelpFormatter) | |
| parser.add_argument('--param', | |
| type=float, | |
| default=5, | |
| required=True, | |
| help='Parameter to adjust how the frobnicator works') | |
| parser.add_argument('input', | |
| type=str, | |
| nargs='+', | |
| help='''Inputs to process''') | |
| return parser.parse_args() | |
| args = parse_args() |