Hint adding codespace scope to auth login (#7961)

This commit is contained in:
Raj Hawaldar 2023-09-21 12:13:27 +05:30 committed by GitHub
parent 94fbbdf9b5
commit c5a7bf8f45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,7 +72,11 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) (*cobra.Command,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// require that the user is authenticated before running most commands
if cmdutil.IsAuthCheckEnabled(cmd) && !cmdutil.CheckAuth(cfg) {
fmt.Fprint(io.ErrOut, authHelp())
if cmd.Parent().Use == "codespace" {
fmt.Fprintln(io.ErrOut, "To get started with GitHub CLI, please run: gh auth login -s codespace")
} else {
fmt.Fprint(io.ErrOut, authHelp())
}
return &AuthError{}
}
return nil