4 ms·
Am I the only one that thought this was a universal format for describing CLI arguments?
by gkfasdfasdf 4y ago
Am I the only one that thought this was a universal format for describing CLI arguments?
- jszymborski 4y agoI certainly thought that.
- radlad 4y agoI've long wished I could "declare" my CLI arguments in a Markdown-like syntax (e.g. using `[]` and `<>` to denote optional vs. required arguments) and have some library figure it all out for me.
- Flimm 4y agoYou're in for a treat: that library already exists and has been ported to multiple programming languages: http://docopt.org http://docopt.org
- gkfasdfasdf 4y agoWow thanks, that does look interesting!
- qbasic_forever 4y agoDoesn't look like it's maintained anymore, sadly. All of the major language repos have long threads trying to figure out who can pick up maintenance of the project.
- lgas 4y agohttps://docopt.org/ https://docopt.org/ may be of interest.
- AndrewDucker 4y agoPowerShell does exactly that for its scripts. And then uses those definitions for autocomplete, validation, etc.
- tmpfs 4y agoI had a go at this a while ago, uses the markdown AST to build a program descriptor: https://github.com/mkdoc/mkcli https://github.com/mkdoc/mkcli I think docopt is a better choice as it has more traction but this experiment showed me a pure markdown implementation is feasible.
- vanderZwan 4y agoNeat! > I think docopt is a better choice as it has more traction Is docopt still being maintained/developed? As another comment indirectly mentions: the original python repo seems abandoned. The other language ports still have more recent updates though.
- qbasic_forever 4y agoConsider protobufs, you have to do a bit more work but if you're going to schematize an API (which a CLI is when you get down to it) it's a good universal option.
- gkfasdfasdf 4y agoHow would that work exactly? So args resolve into a protobuf struct? But how are human readable args parsed into a protobuf?
- endgame 4y agoI go the other way: use optparse-applicative[1] to generate argument parsers for the configs, and generate help commands for each (sub)commands from each parser. [1]: https://hackage.haskell.org/package/optparse-applicative https://hackage.haskell.org/package/optparse-applicative
- layer8 4y agoI’ve never seen “argumentation” used in that context.
- vanderZwan 4y agoNo, but the "arg" in "argdown" is close enough to the typical abbreviation of CLI arguments that it isn't that much of a stretch to imagine someone being primed that way to misread that word.
- RustyRussell 4y agoNo, I clicked through and got confused, came here for enlightenment. Thanks!
- turboponyy 4y agoI figured the same.
- snthpy 4y agoNo