Re:Docli – A declarative language for command-line interface...
by celicoo on Wednesday March 20, 2019 @05:54PM
(#19447381)
I've started with a fork of Docopt, but then I realized the exact same thing - the maintainers didn't use the best parsing practices, so I've just deleted the fork and started Docli. If you follow the tutorial you will see that you can print the AST produced by Docli's parser :D.
Re:Docli – A declarative language for command-line interface...
by cstejerean on Wednesday March 20, 2019 @12:11PM
(#19443617)
So did you end up making something better? I’ve been using docopt for years but I’ll gladly consider switching to a better alternative.
Re:Docli – A declarative language for command-line interface...
by jawher on Thursday March 21, 2019 @03:18AM
(#19449795)
May I suggest you give https://github.com/jawher/mow.cli a look/try ?
Disclaimer: I'm the author of mow.cli ;)
Re:Docli – A declarative language for command-line interface...
by thechao on Wednesday March 20, 2019 @02:54PM
(#19445529)
All of my publicly available thoughts are here: https://github.com/jaroslov/docoptc
My main issues were that the author of docopt doesn't know anything about language grammars & parsing. That's fine — we all start somewhere. But he insists that defining a grammar (and having a rational parser) aren't useful or even possible! If, instead, there were a normative spec (and this requires only the slightest change to edge-cases that aren't tested by his test-suite, anyways), then it'd be possible to really roll out a much more robust docopt than what currently occurs.
With a grammar you'd be able to roll out AST=>AST transforms, and update the parsing strategy of the command lines, i.e., portability between CLI flavors between new/old style POSIX, Windows, etc. You'd have the ability to do i18n, you could catch errors both in the docopt spec of your parser, and in the parsing of the command line options, etc.