commandeer icon indicating copy to clipboard operation
commandeer copied to clipboard

Automatically generate --help

Open ReneSac opened this issue 9 years ago • 2 comments

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

ReneSac avatar Apr 03 '15 20:04 ReneSac

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:

  • the help text of each argument and option
  • the overall description
  • you might as well have the man page generated...

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."

fenekku avatar Apr 09 '15 18:04 fenekku

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

ReneSac avatar Apr 09 '15 19:04 ReneSac