3 ms·
In the workplace we've written a pretty extensive suite of command-line programs in Python using the argparse module. It has some nice features to easily define
by kisielk 14y ago
In the workplace we've written a pretty extensive suite of command-line programs in Python using the argparse module. It has some nice features to easily define subcommands as well as mandatory positional arguments, different argument multiplicities, etc. While most simple command line apps don't need this kind of functionality, the kinds of apps we are writing at my employer often do.
Anyway, neither of those cases are by any means a major downer, just two things that have been niggling me from time to time.
- luriel 14y agoSomebody mentioned recently that the code that is part of the `go` tool that handles sub-commands maybe should be factored out and added to the stdlib, it should be relatively straightforward. If you are also interested in that I would recommend filling an issue in the tracker and if a few more people find it useful it probably will happen sooner rather than latter.
- zemo 14y agoif you're talking about someone mentioning it in #go-nuts, that might have been me. I have a reference project to do that here: https://github.com/jordanorelli/multicommand https://github.com/jordanorelli/multicommand haven't taken time to turn it into a proper library.