I used to love doctopt, but with usage your realise:<p>- i18n is made hard<p>- syntax errors are not caught by tooling<p>- you don't get automatic args checking or env var override<p>Eventually, a well made programmative API is better.
I still feel that cobra and docopt are ungoish despite the author of cobra getting hired on. There's simply too much magic to both of them. I would much rather they improve flags, which is what I use. It really doesn't take that much with flags to add subcommands, etc, but it could be made better.
For servers I prefer using: <a href="https://github.com/alecthomas/kingpin" rel="nofollow">https://github.com/alecthomas/kingpin</a>, allows you to really nicely expand based on main arguments with flags. Also, setting defaults is a joy.<p>For CLIs - <a href="https://github.com/spf13/cobra" rel="nofollow">https://github.com/spf13/cobra</a>.<p>However, will definitely try out Docli whenever I start building something new :)
Seems like Cobra is pretty well established in this space - <a href="https://github.com/spf13/cobra" rel="nofollow">https://github.com/spf13/cobra</a><p>Tho admittedly it works in reverse; it generates the doc/help info rather than parsing it into an AST. It addresses the “boilerplate” issue with code gen as well, but it has a CLI to generate code that’s pretty powerful.<p>For instance, how does docli handle subcommands? How about global vs command specific flags? For any case beyond the basic single command CLI, it seems like there would need to be all sorts of magic and non-obvious formatting requirements on the doc string.
Anyone have a recommendation for Node.js? I've been extremely frustrated with commander [1].<p>[1] <a href="https://www.npmjs.com/package/commander" rel="nofollow">https://www.npmjs.com/package/commander</a>
Not really a fan of this approach. I don't like the duality between the help text and the struct it gets bound to - much prefer the approach of generating the help text from a struct.<p><a href="https://github.com/jessevdk/go-flags" rel="nofollow">https://github.com/jessevdk/go-flags</a> is my favourite option; it's lightweight but amazingly featureful, and I much prefer the declarative approach to a programmatic one like the standard library flags package
Their example here confuse me:<p><a href="https://github.com/celicoo/docli/blob/master/examples/terraform/main.go" rel="nofollow">https://github.com/celicoo/docli/blob/master/examples/terraf...</a><p>`workspace` isn't a boolean flag. So it isn't clear from that example how - or even if - docli can work with more complex conditional arguments.<p>Is someone with any familiarity with this project able to advise how you'd handle that in docli?
For my purpose, go-flags was a great fit.<p><a href="https://github.com/jessevdk/go-flags" rel="nofollow">https://github.com/jessevdk/go-flags</a>
cobra is working pretty well for my needs: <a href="https://asciinema.org/a/192043" rel="nofollow">https://asciinema.org/a/192043</a><p>Nice to see a declarative approach, though. It certainly looks more natural. I'm certainly going to give it a try.