From fa83a5d767636c07c33695d6f695ce498d6fc2d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diogo=20Ferr=C3=A3o?= Date: Mon, 20 May 2024 15:41:40 +0100 Subject: [PATCH] address acceptance comments --- internal/cmd/config/profile/set/set.go | 7 ++++--- internal/cmd/config/profile/unset/unset.go | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/cmd/config/profile/set/set.go b/internal/cmd/config/profile/set/set.go index baa650362..3594883fe 100644 --- a/internal/cmd/config/profile/set/set.go +++ b/internal/cmd/config/profile/set/set.go @@ -50,15 +50,16 @@ func NewCmd(p *print.Printer) *cobra.Command { return fmt.Errorf("set profile: %w", err) } + p.Info("Successfully set active profile to %q\n", model.Profile) + flow, err := auth.GetAuthFlow() if err != nil { p.Debug(print.WarningLevel, "both keyring and text file storage failed to find a valid authentication flow for the active profile") p.Warn("The active profile %q is not authenticated, please login using the 'stackit auth login' command.\n", model.Profile) - } else { - p.Debug(print.DebugLevel, "found valid authentication flow for active profile: %s", flow) + return nil } + p.Debug(print.DebugLevel, "found valid authentication flow for active profile: %s", flow) - p.Info("Successfully set active profile to %q\n", model.Profile) return nil }, } diff --git a/internal/cmd/config/profile/unset/unset.go b/internal/cmd/config/profile/unset/unset.go index 6c30e53e1..f767cbfe4 100644 --- a/internal/cmd/config/profile/unset/unset.go +++ b/internal/cmd/config/profile/unset/unset.go @@ -32,15 +32,16 @@ func NewCmd(p *print.Printer) *cobra.Command { return fmt.Errorf("unset profile: %w", err) } + p.Info("Profile unset successfully. The default profile will be used.\n") + flow, err := auth.GetAuthFlow() if err != nil { p.Debug(print.WarningLevel, "both keyring and text file storage failed to find a valid authentication flow for the active profile") p.Warn("The default profile is not authenticated, please login using the 'stackit auth login' command.\n") - } else { - p.Debug(print.DebugLevel, "found valid authentication flow for active profile: %s", flow) + return nil } + p.Debug(print.DebugLevel, "found valid authentication flow for active profile: %s", flow) - p.Info("Profile unset successfully. The default profile will be used.\n") return nil }, }