X Tutup
Skip to content

Commit 558ff2d

Browse files
committed
Skip authentication message if asking for help
Currently, this still checks authentication, but we skip the authentication message and exit normally.
1 parent c903f1e commit 558ff2d

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

cmd/gh/main.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,18 @@ func mainRun() exitCode {
169169
cs := cmdFactory.IOStreams.ColorScheme()
170170

171171
if cmd != nil && cmdutil.IsAuthCheckEnabled(cmd) && !cmdutil.CheckAuth(cfg) {
172-
fmt.Fprintln(stderr, cs.Bold("Welcome to GitHub CLI!"))
173-
fmt.Fprintln(stderr)
174-
fmt.Fprintln(stderr, "To authenticate, please run `gh auth login`.")
175-
176172
// Print help only if you explicitly ask for help.
177173
lastArgument := expandedArgs[len(expandedArgs)-1]
178174
askingForHelp := lastArgument == "--help" || lastArgument == "-h"
179175
if askingForHelp {
180-
fmt.Fprintln(stderr)
181-
182-
helpHeading := fmt.Sprintf("Printing help for `%s`...\n", cmd.UseLine())
183-
fmt.Fprintf(stderr, cs.Bold(helpHeading))
184-
185176
cmd.Help()
177+
return exitOK
186178
}
179+
180+
fmt.Fprintln(stderr, cs.Bold("Welcome to GitHub CLI!"))
181+
fmt.Fprintln(stderr)
182+
fmt.Fprintln(stderr, "To authenticate, please run `gh auth login`.")
183+
187184
return exitAuth
188185
}
189186

0 commit comments

Comments
 (0)
X Tutup