diff --git a/cmd/setup.go b/cmd/setup.go index 63bb31da3..3da1ce2df 100644 --- a/cmd/setup.go +++ b/cmd/setup.go @@ -206,11 +206,14 @@ func setupDiagnosticCheck(opts setupOptions) { fmt.Println("Ok.") } - fmt.Printf("Trying to query your username given the provided token... ") + fmt.Printf("Trying to query our API for your profile name... ") responseWho, err := api.WhoamiQuery(opts.cl) - if err != nil || responseWho.Me.Name == "" { - fmt.Println("\nUnable to query the GraphQL API for your username, please check your settings.") + if err != nil { + fmt.Println("\nUnable to query our API for your profile name, please check your settings.") + // If user does not have a name set in their VCS, let's just say hi :) + } else if responseWho.Me.Name == "" { + fmt.Printf("Hello!") } else { fmt.Printf("Hello, %s.\n", responseWho.Me.Name) } diff --git a/cmd/setup_unit_test.go b/cmd/setup_unit_test.go index 011acae4a..57dc3b67f 100644 --- a/cmd/setup_unit_test.go +++ b/cmd/setup_unit_test.go @@ -132,7 +132,7 @@ Setup complete. Your configuration has been saved to %s. Trying an introspection query on API to verify your setup... Ok. -Trying to query your username given the provided token... Hello, %s. +Trying to query our API for your profile name... Hello, %s. `, tempSettings.Config.Path, `zomg`))) tempSettings.AssertConfigRereadMatches(fmt.Sprintf(`host: %s @@ -162,7 +162,7 @@ Setup complete. Your configuration has been saved to %s. Trying an introspection query on API to verify your setup... Ok. -Trying to query your username given the provided token... Hello, %s. +Trying to query our API for your profile name... Hello, %s. `, tempSettings.Config.Path, `zomg`))) tempSettings.AssertConfigRereadMatches(fmt.Sprintf(`host: %s @@ -242,7 +242,7 @@ Your configuration has been saved to %s. Trying an introspection query on API to verify your setup... Unable to make a query against the GraphQL API, please check your settings. -Trying to query your username given the provided token... Hello, %s. +Trying to query our API for your profile name... Hello, %s. `, tempSettings.Config.Path, `zomg`))) }) }) @@ -316,8 +316,8 @@ Setup complete. Your configuration has been saved to %s. Trying an introspection query on API to verify your setup... Ok. -Trying to query your username given the provided token... -Unable to query the GraphQL API for your username, please check your settings. +Trying to query our API for your profile name... +Unable to query our API for your profile name, please check your settings. `, tempSettings.Config.Path))) }) })