-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/gopls: improve command-line help output #35855
Comments
I'll work on this one. |
@stamblerre Currently all of the commands are printed as a signle list:
What do you think about separating this into "main" (looking for better naming) commands and "features" that can be run adhoc like this:
I think it shows intent of the commands more clearly. |
@jbszczepaniak: That sounds reasonable to me! |
OK, one more question. Should running command without any flag nor command behave like this? I find it confusing:
If you'll not provide valid json rpc message it does nothing and when you hit enter you get missing content message. My proposition is to print help whenever you run just |
And one more again ;)
concern only gopls |
@jbszczepaniak: Both of your comments sound good! We can also have more discussion once you send out a CL for review. |
@stamblerre could you tell me about this compatibility thing?
It pops here as well https://github.com/golang/tools/blob/master/internal/lsp/cmd/cmd.go#L43:
With this my proposal cannot be done and probably I am missing some context and discussion that took place some time ago. |
Change https://golang.org/cl/210359 mentions this issue: |
I decided to submit first change for this issue to keep things small. Things I didn't do:
|
Descriptions of certain commands were changed to not start with capital letter. All of the commands were splitted into so called main commands and feature commands. Package tool did have a limitation that revealed itself when command was invoked only with `-h`, i.e. `gopls -h`. Limitation was that in above mentioned case, FlagSet.Parse() was intercepting `-h` flag and printing just default usage. Updates golang/go#35855 Change-Id: I9bd27fc72e8fb8d18025d95ebcae974dd5583e91 Reviewed-on: https://go-review.googlesource.com/c/tools/+/210359 Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
I think we should closed this issue, since the PR has already been merged. cc @stamblerre |
Hm, actually I think there is still work to do here (see #35855 (comment)).
Dealing with |
Change https://golang.org/cl/330854 mentions this issue: |
Change https://golang.org/cl/330949 mentions this issue: |
Currently, flags are not being printed when users run `gopls help` because they never get parsed in Main. This CL fixes that issue. Updates golang/go#35855 Change-Id: Ic9882d0d2410a0f045aa0ecaa87b36c23eb569fd Reviewed-on: https://go-review.googlesource.com/c/tools/+/330854 Trust: Jean de Klerk <deklerk@google.com> Run-TryBot: Jean de Klerk <deklerk@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
@stamblerre as far as I'm concerned, we can close this issue. I'll leave it open since you indicated that we should still add |
I installed
golang.org/x/tools/gopls@latest
and tried to look at its command-line tool options (rename, etc).First I tried
-h
, since this is a typical way to make Go tools show usage:So this shows the flags (for which command?), but not the actual commands. Next I tried
gopls help
:That works, but only accidentally ("Unknown command help"). Also note the trailing "gopls flags are:" followed by no flags.
Finally, I tried running
gopls rename -h
to see how one uses this tool:This does not provide enough information to actually use
gopls rename
.We should improve this situation:
gopls -h
should print out the possible commands.gopls <command> -h
to find the flags for a particular command.-h
output could say what the command actually does and how to use it, not just list the flags.For bonus points:
gopls help
could be a synonym forgopls -h/-help
, since that's a common paradigm for "sub-command"-style tools (seego help
for example).The text was updated successfully, but these errors were encountered: