-
Notifications
You must be signed in to change notification settings - Fork 216
Recommendation: gh --help
and gh [command] --help
descriptions
#590
Comments
Hey @ericnewton76 that is a fantastic recommendation. Also sometimes I would like to see flags for a cmds for a level deeper like at But I agree that it should be accessible at the cmd line level. This is a CLI tool after all right?! We are using an option parser which is pretty low level and does not include a If anyone has any recommendations on how to implement this I am all ears! |
Like I mentioned before, I am pretty familiar with Commander defines the options: program.option('-l,--list', "List Repos for the user")
.option("--per-page", "Sets number of items per page", -1)
.option("-t,--type", "(description of type). Allowed values: all,forks,member,owner,public,private,sources)")
program.parse(process.argv)
//now program object has the options:
if(program.verbose) { turnOnVerbose(); }
if(program.type == "all") { doTypeAll(program["per-page"]); } Can even have a function for defaultValue, which can do type checking on options. Its pretty powerful, with the goal in mind of establishing what's available on the command line, versus noopt's handling of just taking everything encountered on the commandline and presenting it as a javascript object. One great thing about commander is when --help is invoked, its an automagic thing, for the most part. Also allows for a help callback to possibly list out values without having to embed them in the above descriptions, (ie, str substitution, like "#{type_options_enumerated}#" and replace that str with the Object.keys of an object that is the actual options, etc. On another note, I feel like --list shouldn't be an option, but a subcommand of repo... so any of those "flags that can execute an action" change to a subcommand, like so:
Although I'm not sure how you guys feel about that aspect (ie, make subsub-commands proper subsub commands... lol) |
Ya I like commander as well and have used it on side projects. I agree with you that it should be practically considered a sub command ha. It's difficult to reconcile in that I would prefer to stay backwards compatible but also use the sub command signature you mentioned. Even something like Do you have any thoughts on how to keep this backwards compatible while moving forward with the proper subcommand format? |
I would actually just declare the change, kick the version major up, and let the consumers decide when they're ready. |
Thanks for the feedback, this is definitely on my todo list! |
Hi. Just trying out gh and realized many of the commands don't have much (if at all) descriptions
So I'm somewhat unsure how to use it without dipping into the source code.
Like what does --gitignore "string" do?
What command line parser are you using? I'm familiar with https://www.npmjs.com/package/commander
The text was updated successfully, but these errors were encountered: