Created
November 14, 2016 06:59
-
-
Save byrney/65bcbb095c8056e054c9a87f02ef8c59 to your computer and use it in GitHub Desktop.
Python docopt example
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
""" | |
Usage: | |
program run [options] [--] (FILE... | --stdin) | |
program load [options] [--] (FILE... | --stdin) | |
Options: | |
-d DATABASE --database=DATABASE Specify database | |
-v --verbose Be verbose | |
-h --help Show this screen. | |
-V --version Version information | |
""" | |
import sys | |
if __name__ == '__main__': | |
import docopt | |
args = docopt.docopt(__doc__.replace('program', sys.argv[0]), version='Command 0.1') | |
print(args) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment