davetron5000 / gli

Make awesome command-line applications the easy way
http://davetron5000.github.io/gli
Apache License 2.0
1.26k stars 102 forks source link

"requires a subcommand" error without examples #298

Closed JacobEvelyn closed 4 years ago

JacobEvelyn commented 4 years ago

I noticed an inconsistency in the help message when using commands that require subcommands. When I call the list command in my friends CLI app, it gives examples:

friends list
Error: Command 'list' requires a subcommand friends,activities,notes,locations,tags,favorite

but when I use one of those subcommands that also requires further subcommands, I see no examples:

friends list favorite
Error: Command 'favorite' requires a subcommand

Is there a way to get that second example to also show the subcommand options?

davetron5000 commented 4 years ago

Yeah, that doesn't seem right.

It looks like this line of code:

https://github.com/davetron5000/gli/blob/85792ea395ce72069cbd6190ecaca26dfaea2684/lib/gli/command_support.rb#L173

Should probably include the same thing as this one:

https://github.com/davetron5000/gli/blob/85792ea395ce72069cbd6190ecaca26dfaea2684/lib/gli/command_support.rb#L176

or maybe have the same check?

If you feel like making a PR, I can check it out and . I might not have bandwidth to do the change myself for the next few weeks or so.

JacobEvelyn commented 4 years ago

Thanks, @davetron5000 ! I'll look into making a PR in the next week or so.