Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no_args_is_help for command? #499

Closed
chris-hailstorm opened this issue Jan 1, 2016 · 9 comments
Closed

no_args_is_help for command? #499

chris-hailstorm opened this issue Jan 1, 2016 · 9 comments

Comments

@chris-hailstorm
Copy link

When creating a MultiCommand (like a Group), there is a useful option no_args_is_help -- if set, invoking the group without a parameter or subcommand prints the help message for the group, e.g. program is equivalent to program --help.

However the same option doesn't exist for subcommands, so program subcommand produces an error message -- is not equivalent to program subcommand --help.

Is there an option I'm missing?

Thanks

@jdell64
Copy link

jdell64 commented Jan 6, 2016

I'd like to use no_args_is_help in just command as well.

I added this in the core.py file... I'm still new to open source projects, so I'm not sure how to do a pull request (or even how to test it).

@jdell64
Copy link

jdell64 commented Jan 6, 2016

I did a pull request. #502

@untitaker
Copy link
Contributor

Hello @jdell64, sorry for the late response!

I don't think using this option would be a good idea, since it obscures the reason the usage was invalid. I'd prefer a solution a la #393, which seems like a perfect middle-ground that prevents us from adding options for every single color of the bikeshed.

At the same time just showing help sort-of makes sense for groups, although I do wish that there'd be an error message at the top, explaining why click shows the help.

@jdell64
Copy link

jdell64 commented Mar 30, 2016

I was trying to emulate some old command-line applications that do this:

Linux

  • ping
  • sudo
  • ssh

Windows

  • ping
  • ssh

And other examples.

To your point, not all applications do this:

  • cp

There are some (I cannot remember which) that do both:

someCommand.exe
Error: missing arg0 - filename
{help text here}

@untitaker
Copy link
Contributor

Click has some very strong opinions about how a good CLI should look (e.g. #108) Using it as a way of emulating another interface is going to fail badly, especially as those interfaces may not be consistent and would require Click to be inconsistent (either by default or via opt-in) as well.

@jdell64
Copy link

jdell64 commented Mar 30, 2016

Does the code I submitted introduce instability or it just doesn't conform to the desired output of Click?

I haven't contributed to many OS projects, so I apologize if I missed the mark here.

@untitaker
Copy link
Contributor

Your code is perfect for the thing you want to do, but I remain unconvinced that the thing you want to do is a good idea from a UX perspective. I'm also not claiming that Click's current solution is perfect, but that probably depends.

In the end it's just bikeshedding, would like to hear a few opinions from others first. @mitsuhiko @RonnyPfannschmidt

@jdell64
Copy link

jdell64 commented Apr 22, 2016

Well, bikeshedding is the only way I can contribute :D

My opinion (for what its worth) is that it isn't on by default, and shouldn't really affect most users. I guess it could bog down the code base.

@davidism
Copy link
Member

Decision made to keep current "see --help" message in #502.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants