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
how to implement number argument? #522
Comments
Hello @xhawk18 I will suppose you've read http://docopt.org/ So In case you missed the fork: pip install docopt-ng """
Usage: ./test-docopt-number.py [--std=<ver>] [-O NUM_OPTIMIZE]
"""
from docopt import docopt
args = docopt(__doc__)
print(args)
if args['-O']:
if args['NUM_OPTIMIZE'].isdigit():
optimization = int(args['NUM_OPTIMIZE'])
else:
raise RuntimeError(f"argument NUM_OPTIMIZE must be an int: {args['NUM_OPTIMIZE']}")
print(f"optimization: {optimization}") Was it a feature request or an help support? If it was for help request, stackoverflow would have been a more useful source of information. 😉 |
Thank you @Sylvain303 ! It may be a feature request 😉 |
You're welcome. 😁 Unfortunately this main github repository is deprecated / stalled 😢 see related issue #371 the forked python code ➡️ https://github.com/bazaar-projects/docopt-ng |
e.g.
gcc --std=c++20 -O0
gcc --std=c++20 -O1
gcc --std=c++20 -O2
Can I write docotp USAGE like this?
gcc [--std=<ver>] [-O (0|1|2)]
I seems not work.
The text was updated successfully, but these errors were encountered: