From 82bdf6996544b3942971c046819d953229ee8a90 Mon Sep 17 00:00:00 2001 From: Radoslav Dimitrov Date: Mon, 20 Nov 2023 14:44:05 +0200 Subject: [PATCH] Update quickstart command message layout (#1696) Signed-off-by: Radoslav Dimitrov --- cmd/cli/app/quickstart/quickstart.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/cmd/cli/app/quickstart/quickstart.go b/cmd/cli/app/quickstart/quickstart.go index ea9e86ade6..c433f1eeab 100644 --- a/cmd/cli/app/quickstart/quickstart.go +++ b/cmd/cli/app/quickstart/quickstart.go @@ -115,7 +115,7 @@ You can now continue to explore Minder's features by adding or removing more rep For more information about Minder, see: * GitHub - https://github.com/stacklok/minder * CLI commands - https://minder-docs.stacklok.dev/ref/cli/minder -* Rules and profiles maintained by Minder's team - https://github.com/stacklok/minder-rules-and-profiles +* Minder rules & profiles - https://github.com/stacklok/minder-rules-and-profiles * Official documentation - https://minder-docs.stacklok.dev Thank you for using Minder! @@ -275,6 +275,7 @@ var cmd = &cobra.Command{ ctx, cancel = util.GetAppContext() defer cancel() + alreadyExists := "" resp, err := client.CreateProfile(ctx, &minderv1.CreateProfileRequest{ Profile: p, }) @@ -283,20 +284,26 @@ var cmd = &cobra.Command{ if st.Code() != codes.AlreadyExists { return fmt.Errorf("error creating profile: %w", err) } - cmd.Println("Hey, it seems you already tried the quickstart command and created such a profile. " + - "In case you have registered new repositories this time, the profile will be already applied " + - "to them.") + alreadyExists = "Hey, it seems you already tried the quickstart command and created such a profile. " + + "In case you have registered new repositories, the profile will be already applied to them." } else { return fmt.Errorf("error creating profile: %w", err) } + } + + // Finish - Confirm profile creation + cli.PrintCmd(cmd, cli.WarningBanner.Render(stepPromptMsgFinish)) + + // Print the "profile already exists" message, if needed + if alreadyExists != "" { + cli.PrintCmd(cmd, cli.WarningBanner.Render(alreadyExists)) } else { + // Print the profile create result table + cmd.Println("Profile details (minder profile list -p github):") table := profile.InitializeTable(cmd) profile.RenderProfileTable(resp.GetProfile(), table) table.Render() } - - // Finish - Confirm profile creation - cli.PrintCmd(cmd, cli.WarningBanner.Render(stepPromptMsgFinish)) return nil }, }