File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,6 +131,9 @@ func rootHelpFunc(command *cobra.Command, args []string) {
131131 if command .Example != "" {
132132 helpEntries = append (helpEntries , helpEntry {"EXAMPLES" , command .Example })
133133 }
134+ if _ , ok := command .Annotations ["help:environment" ]; ok {
135+ helpEntries = append (helpEntries , helpEntry {"ENVIRONMENT VARIABLES" , command .Annotations ["help:environment" ]})
136+ }
134137 helpEntries = append (helpEntries , helpEntry {"LEARN MORE" , `
135138Use "gh <command> <subcommand> --help" for more information about a command.
136139Read the manual at https://cli.github.com/manual` })
Original file line number Diff line number Diff line change @@ -111,9 +111,28 @@ var RootCmd = &cobra.Command{
111111 $ gh pr checkout 321
112112 ` ),
113113 Annotations : map [string ]string {
114- "help:feedback" : `
115- Fill out our feedback form https://forms.gle/umxd3h31c7aMQFKG7
116- Open an issue using “gh issue create -R cli/cli”` },
114+ "help:feedback" : heredoc .Doc (`
115+ Fill out our feedback form https://forms.gle/umxd3h31c7aMQFKG7
116+ Open an issue using “gh issue create -R cli/cli”
117+ ` ),
118+ "help:environment" : heredoc .Doc (`
119+ GITHUB_TOKEN: an authentication token for API requests. Setting this avoids being
120+ prompted to authenticate and overrides any previously stored credentials.
121+
122+ GH_REPO: specify the GitHub repository in "OWNER/REPO" format for commands that
123+ otherwise operate on a local repository.
124+
125+ GH_EDITOR, GIT_EDITOR, VISUAL, EDITOR (in order of precedence): the editor tool to use
126+ for authoring text.
127+
128+ BROWSER: the web browser to use for opening links.
129+
130+ DEBUG: set to any value to enable verbose output to standard error. Include values "api"
131+ or "oauth" to print detailed information about HTTP requests or authentication flow.
132+
133+ NO_COLOR: avoid printing ANSI escape sequences for color output.
134+ ` ),
135+ },
117136}
118137
119138var versionCmd = & cobra.Command {
Original file line number Diff line number Diff line change @@ -109,6 +109,11 @@ original query accepts an '$endCursor: String' variable and that it fetches the
109109 }
110110 '
111111 ` ),
112+ Annotations : map [string ]string {
113+ "help:environment" : heredoc .Doc (`
114+ GITHUB_TOKEN: an authentication token for API requests.
115+ ` ),
116+ },
112117 Args : cobra .ExactArgs (1 ),
113118 RunE : func (c * cobra.Command , args []string ) error {
114119 opts .RequestPath = args [0 ]
You can’t perform that action at this time.
0 commit comments