2 ms·
Docopt looks like a useful library, but I'd be interested to see how intelligent the "help" parsing is when faced with slight variations in the format. Using C
by smoyer 14y ago
Docopt looks like a useful library, but I'd be interested to see how intelligent the "help" parsing is when faced with slight variations in the format.
Using Commons-CLI in Java actually goes the opposite direction and if can be reasonably terse (one line per parameter or option) but it's also got to be wrapped in a class and have the rest of the Java boilerplate (a main method to execute, etc).
Perhaps I'll try it on my next NodeJS project.
- halst 14y agodocopt is even more terse than 1 line per argument/option/command. Take an example: Usage: quick_example.py tcp <host> <port> [--timeout=<seconds>] quick_example.py serial <port> [--baud=9600] [--timeout=<seconds>] quick_example.py -h | --help | --version 2 commands, 3 arguments, 5 options: in only 3 lines of DSL. Take a look at more examples: https://github.com/docopt/docopt/tree/master/examples https://github.com/docopt/docopt/tree/master/examples
- halst 14y agoWhen the DSL (http://docopt.org/ http://docopt.org/) was designed, the main goal was just to formalise that pattern-language used for decades in man pages and `--help` screens. So variations that are conventional (such as `UPPER-CASE` for arguments or `<angular-brackets>` for arguments) are supported.