Skip to content

Commit

Permalink
tenants use shouldn't trigger logins
Browse files Browse the repository at this point in the history
Since this command shouldn't really touch logins, it should ideally not
be part of the set of commands triggering `RunLogin`.
  • Loading branch information
cyx committed Mar 6, 2021
1 parent 72c1a66 commit dd7b626
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions internal/cli/tenants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
}
Expand Down

0 comments on commit dd7b626

Please sign in to comment.