Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Command line parameter parsing

Aug
124
0
Does Take Command have something similar to Python's optparse/argparse module or to GNU's getopt or Linux shell's getopts command or would I have to completely script option handling myself?

How would I start doing this? Has anyone ever done it?

I would like to mimic the following script output I have in Python:

> script.py --help
usage: script.py [-h] [-v]

script.py does something

Special options:
-h, --help show this help message and exit
-v, --version show program's version number and exit

> script.py -v
script.py 1.0

> script.py -f
usage: script.py [-d] [-h] [-v]
script.py: error: unrecognized arguments: -f
 
Does Take Command have something similar to Python's optparse/argparse module or to GNU's getopt or Linux shell's getopts command or would I have to completely script option handling myself?

NthArgument() might be what you're looking for. (I haven't used it myself; being basically dumb, I wrote my own arg parser, and tweak it to fit the needs of each plugin.)
 
Back
Top