4 ms·
You might find http://docopt.org/ http://docopt.org/ to be of interest. (It's available in many languages https://github.com/docopt https://github.com/docopt).
by lgas 4y ago
You might find http://docopt.org/ http://docopt.org/ to be of interest. (It's available in many languages https://github.com/docopt https://github.com/docopt).
- abathur 4y agoParsers designed for implementing CLI programs are generally too opinionated to handle ~strange commands. (In my terms I'd say it's a prescriptive parser as opposed to something that attempts to be flexible enough to describe nearly all existing CLIs).
- ablob 4y agoWouldn't it be easier to have a convenient library/parser for almost all of the use cases instead of an immensely complex catch-all solution? Having custom logic when required should almost always be less complex when such a ~strange command is to be implemented.
- abathur 4y agoAs I said, my usecase doesn't involve implementing the commands--it involves reliably identifying executables in the arguments to many different commands. I can't go rewrite awk, find, and sed with an opinionated cli module. I have to deal with the current reality. (you're roughly describing what I already do, and it scales poorly)