Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmd/src/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ func loginCmd(ctx context.Context, p loginParams) error {
}

_, flow := selectLoginFlow(p)
return flow(ctx, p)
if err := flow(ctx, p); err != nil {
return err
}
fmt.Fprintf(p.out, "\n💡 Tip: To use this endpoint in your shell, run:\n\n export SRC_ENDPOINT=%s\n\n", p.cfg.endpointURL)
return nil
}

// selectLoginFlow decides what login flow to run based on configured AuthMode.
Expand Down
4 changes: 2 additions & 2 deletions cmd/src/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestLogin(t *testing.T) {
if err != nil {
t.Fatal(err)
}
wantOut := "✔︎ Authenticated as alice on $ENDPOINT"
wantOut := "✔︎ Authenticated as alice on $ENDPOINT\n\n\n💡 Tip: To use this endpoint in your shell, run:\n\n export SRC_ENDPOINT=$ENDPOINT"
wantOut = strings.ReplaceAll(wantOut, "$ENDPOINT", s.URL)
if out != wantOut {
t.Errorf("got output %q, want %q", out, wantOut)
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestLogin(t *testing.T) {
t.Fatal("expected stored oauth token to avoid device flow")
}
gotOut := strings.TrimSpace(out.String())
wantOut := "✔︎ Authenticated as alice on $ENDPOINT\n\n\n✔︎ Authenticated with OAuth credentials"
wantOut := "✔︎ Authenticated as alice on $ENDPOINT\n\n\n✔︎ Authenticated with OAuth credentials\n\n💡 Tip: To use this endpoint in your shell, run:\n\n export SRC_ENDPOINT=$ENDPOINT"
wantOut = strings.ReplaceAll(wantOut, "$ENDPOINT", s.URL)
if gotOut != wantOut {
t.Errorf("got output %q, want %q", gotOut, wantOut)
Expand Down
Loading