3 ms·
https://github.com/clibs/flag https://github.com/clibs/flag is yet-another approach, more like Go's flag package. Docopt is awesome too.
by tjholowaychuk 11y ago
https://github.com/clibs/flag https://github.com/clibs/flag is yet-another approach, more like Go's flag package. Docopt is awesome too.
- cperciva 11y agoI considered going with something along those lines, but figured that for us crufty UNIX people it was far more likely to be useful as a drop-in replacement for an existing C getopt loop.
- LukeShu 11y agodocopt is almost perfect. It needs to support optional flag arguments (á la `--color[=WHEN]), and having the first un-indented line after `Usage:` be treated as prose. The latter is on `master` of the Python (reference) implementation, but hasn't landed in a release or a spec. Also, better errors for when the programmer screws up the formatting of the doc string.
- ridiculous_fish 11y agoShameless self-plug: you may be interested in my version of docopt at https://github.com/ridiculousfish/docopt_fish https://github.com/ridiculousfish/docopt_fish . Its syntax is more forgiving, it's capable of expressing more usage specs, and it has excellent error reporting for doc strings.
- LukeShu 11y agoVery cool! I'll definitely keep it in mind (though I've been tending to use Go for greenfield projects recently).