From dd7b626acb647ed1139b73da0fd74a7f3f163f74 Mon Sep 17 00:00:00 2001 From: Cyril David Date: Fri, 5 Mar 2021 15:49:06 -0800 Subject: [PATCH] tenants use shouldn't trigger logins Since this command shouldn't really touch logins, it should ideally not be part of the set of commands triggering `RunLogin`. --- internal/cli/root.go | 5 +++++ internal/cli/tenants.go | 1 + 2 files changed, 6 insertions(+) diff --git a/internal/cli/root.go b/internal/cli/root.go index 62778e246..e18bceb75 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -34,6 +34,11 @@ func Execute() { return nil } + // Selecting tenants shouldn't really trigger a login. + if cmd.Use == "use" && cmd.Parent().Use == "tenants" { + return nil + } + // Initialize everything once. Later callers can then // freely assume that config is fully primed and ready // to go. diff --git a/internal/cli/tenants.go b/internal/cli/tenants.go index 12344f3ff..03476e381 100644 --- a/internal/cli/tenants.go +++ b/internal/cli/tenants.go @@ -57,6 +57,7 @@ func useTenantCmd(cli *cli) *cobra.Command { if err := cli.persistConfig(); err != nil { return fmt.Errorf("An error occurred while setting the default tenant: %w", err) } + cli.renderer.Infof("Default tenant switched to: %s", selectedTenant) return nil }, }