From ed8445093f6ae2b332787a29b087bdf452a94013 Mon Sep 17 00:00:00 2001 From: Dan Adler <5589410+dadlerj@users.noreply.github.com> Date: Mon, 6 Apr 2026 14:33:14 -0700 Subject: [PATCH] Add tip to set env var after login --- cmd/src/login.go | 6 +++++- cmd/src/login_test.go | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/src/login.go b/cmd/src/login.go index 43ccfe0347..9818c245b6 100644 --- a/cmd/src/login.go +++ b/cmd/src/login.go @@ -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. diff --git a/cmd/src/login_test.go b/cmd/src/login_test.go index 6a286c4b5a..1250d1adb9 100644 --- a/cmd/src/login_test.go +++ b/cmd/src/login_test.go @@ -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) @@ -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)