fenekku / commandeer

Take command of your command line in Nim
MIT License
94 stars 14 forks source link

Automatically generate --help #2

Open ReneSac opened 9 years ago

ReneSac commented 9 years ago

This module should automatically generate the help text based on the command line interface provided and not force you to repeat yourself. Kinda the opposite of: https://github.com/docopt/docopt.nim

fenekku commented 9 years ago

Thanks for pointing that out. This is an 'ugly' problem I find.

Right now the arguments and options are not associated with a custom name so mapping them back to a help text would result in <int> and such which is not great. Adding a custom name as another parameter is too distracting. Using the argument variable name is our best bet but I don't know how to do so without going macros all the way -which I don't want to do.

An auto-generated help/usage text should be overridden by exitoption "--help" or instead only be made available through a documented call so that the end result may be further customizable and the format is not forced upon the user.

It is also a slippery slope, there is a ton of additional metadata you would want to squeeze in to make the usage/help text actually helpful:

I am ok with auto-generating a one line usage text. For anything more involved I actually like that the developer needs to write it out. I am open to proposed solutions though :smile_cat: .

I am abiding by my design rule until there is an elegant way to deal with this: "Keep it simple and streamlined. Command line parsers can do a lot for you, but I prefer to be in adequate control."

ReneSac commented 9 years ago

Yeah, it indeed is somewhat of a slippery slope. I would surely ask for the first two bullet points you listed. Only because I rarely use man pages, though. ;)

But on the other hand, for anything I would have to write the proper help text, I would probably migrate to a future macroed docopt. The competion is open! XD