1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Command line parameter parsing

Discussion in 'Plugins' started by thorsten, Dec 30, 2012.

  1. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    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
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    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.)
     
  3. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    Looks like I asked in the wrong sub-forum (plugins). I'm going to repost it under scriipting
     

Share This Page