Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Add sketch of specifying option groups #486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions examples/option_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Example of program with many options groups using docopt.

Usage:
option_groups.py [--port=<port>] [cert_opts] [options] serve <fsroot>
option_groups.py [--port=<port>] [cert_opts] [options] upload <host> <file>...
option_groups.py [options] changes <local_dir>
option_groups.py (-h | --help)
option_groups.py --version

Arguments:
<fsroot> local directory to serve
<file> file(s) to upload
<local_dir> directory to check for local changes

Certificate options [cert_opts]:
--certfile=<certfile> X509 certificate
--keyfile=<keyfile> key for certificate

General options [options]:
-v --verbose print status messages

Other options:
-h --help show this help message and exit
--version show version and exit
-p <port> --port=<port> port to use

"""
from docopt import docopt


if __name__ == '__main__':
arguments = docopt(__doc__, version='1.0.0')
print(arguments)