Skip to content

Update gh help output - #815

Merged
probablycorey merged 12 commits into
masterfrom
heathy-helping
Apr 27, 2020
Merged

probablycorey merged 12 commits into
masterfrom
heathy-helping

Conversation

@probablycorey

@probablycorey probablycorey commented Apr 22, 2020 •

Copy link
Copy Markdown
Contributor

This is an update to the help documentation based on ideas from @ampinsk (https://github.slack.com/archives/CLU79NDAS/p1587488768040500).

Before

After

Technical issue

I was hoping I could do more with Cobra to make the help documentation more automatic. For example, if I could add metadata to commands then separating “core” and "additional" commands would be possible with cmd.SetHelpTemplate. Unfortunately, without some extreme hacking to our commands I couldn't figure out a way to make that possible. But I don't think this is something to worry about because this code is still mostly generated via commands and now all the help documentation is in one place making it easier to edit in the future

Responses to comments

“commands are run inside of a GitHub repository”: as you pointed out in another thread, this isn't always true. it won't be true for some gh repo create, some gh repo fork, and usually for gh repo clone. it also isn't true for any use of gh -R owner/repo, nor for gh config, nor will it be true for gh api when a direct API access command lands. so I'd avoid stating this as some kind of rule. maybe somewhere in the lower description we can say something like "it makes sense to run most commands from the directory of a local git repository.”

I tried to address this with the line "most gh commands need to be run in a directory containing a GitHub repository." But maybe the user would benefit more if our commands have a better error when they are run in a directory without a repository.

  1. “read the manual at”: they’re already reading the manual! the whole point of having the manual at their fingertips on the command-line is so that they don’t have to go elsewhere to read the documentation. also, the online manual will not necessarily match their installed version of gh. I strongly feel that we should not link to the manual elsewhere.

We differ on this point. The help output is very high-level so I don’t see it as the manual for the app. I go the web to read documentation and see example usage for commands like find and grep because I find it easier to read than text on the terminal. I see including this as a way to make web documentation discoverable to people who might benefit from it.

Closes #711

@probablycorey
probablycorey requested review from mislav and vilmibm April 22, 2020 17:42
@probablycorey probablycorey self-assigned this Apr 22, 2020

@ampinsk ampinsk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so excited about this! ✨ Already looks so much cleaner. I left some more specific comments below, but to respond to some more general things:

I tried to address this with the line "most gh commands need to be run in a directory containing a GitHub repository." But maybe the user would benefit more if our commands have a better error when they are run in a directory without a repository.

I'm also still a little stumped on how to manage this! Maybe the error message is the way to go.

We differ on this point. The help output is very high-level so I don’t see it as the manual for the app. I go the web to read documentation and see example usage for commands like find and grep because I find it easier to read than text on the terminal. I see including this as a way to make web documentation discoverable to people who might benefit from it.

+1 on this! I think even though a lot of the content is the same, the website is just easier to navigate and discover things for a lot of people. I think we see a need for this since we get a decent amount of issues of people not knowing a flag was available, or that certain commands exist. We're not forcing people to use it and the help commands are all available for anyone who wants to learn that way.

Comment thread command/root.go Outdated
Comment thread command/root.go Outdated
gh <command> [subcommand] [flags]`},
{"CORE COMMANDS", strings.Join(coreCommands, "\n")},
{"ADDITIONAL COMMANDS", strings.Join(additionalCommands, "\n")},
{"FEEDBACK", `

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of surfacing the feedback prominently, but it feels a little odd to put this in between the commands and flags. I don't mind it being at the bottom! Since everything is clearer now I think it'll still be easy to spot.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread command/root.go Outdated
Comment thread command/root.go
Comment thread command/root.go Outdated
{"ADDITIONAL COMMANDS", strings.Join(additionalCommands, "\n")},
{"FEEDBACK", `
Fill out our feedback form <https://forms.gle/umxd3h31c7aMQFKG7>
Open an issue using “gh issue create -R cli/cli`},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Open an issue using “gh issue create -R cli/cli`},
Open an issue using “gh issue create -R cli/cli”},

Looks like a typo!

probablycorey and others added 5 commits April 22, 2020 13:46
@vilmibm vilmibm changed the title Update ghd help output Update gh help output Apr 22, 2020
@vilmibm

vilmibm commented Apr 22, 2020

Copy link
Copy Markdown
Contributor

(looks like the before image is not what we have now? or am i misreading?)

@probablycorey

Copy link
Copy Markdown
Contributor Author

@ampinsk I've update the screenshot and code with your suggested changes
@vilmibm You're right, I fixed the before image to actually be the before image now.

@vilmibm vilmibm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! i think this is a good balance between automated/manual generation.

@probablycorey

Copy link
Copy Markdown
Contributor Author

I'm going to merge this. @ampinsk, should we start looking at redoing the help pages for pr issue and repo now?

@probablycorey
probablycorey merged commit 2d0d86f into master Apr 27, 2020
@ampinsk

ampinsk commented Apr 27, 2020

Copy link
Copy Markdown

@probablycorey yes definitely!

@mislav
mislav deleted the heathy-helping branch June 25, 2020 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restructure gh help by splitting core commands and ancillary commands in groups

4 participants