Skip to content

Commit

Permalink
Merge pull request #614 from overmindtech/improve-ux
Browse files Browse the repository at this point in the history
Added shutdown spinner & auto-populate code
  • Loading branch information
dylanratcliffe authored Oct 16, 2024
2 parents 5497b5d + 61a8775 commit c72573f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmd/explore.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ func Explore(cmd *cobra.Command, args []string) error {
return fmt.Errorf("error reading keyboard input: %w", err)
}

// This spinner will spin forever as the command shuts down as this could
// take a couple of seconds and we want the user to know it's doing
// something
_, _ = pterm.DefaultSpinner.WithWriter(multi.NewWriter()).Start("Shutting down")

return nil
}

Expand Down
8 changes: 7 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,14 @@ func getOauthToken(ctx context.Context, oi sdp.OvermindInstance, requiredScopes
}

var token *oauth2.Token
var urlToOpen string
if deviceCode.VerificationURIComplete != "" {
urlToOpen = deviceCode.VerificationURIComplete
} else {
urlToOpen = deviceCode.VerificationURI
}

_ = browser.OpenURL(deviceCode.VerificationURI) // nolint:errcheck // we don't care if the browser fails to open
_ = browser.OpenURL(urlToOpen) // nolint:errcheck // we don't care if the browser fails to open
pterm.Print(
markdownToString(MAX_TERMINAL_WIDTH, fmt.Sprintf(
beginAuthMessage,
Expand Down

0 comments on commit c72573f

Please sign in to comment.