Skip to content

Commit

Permalink
Update quickstart command message layout (#1696)
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslav Dimitrov <[email protected]>
  • Loading branch information
rdimitrov authored Nov 20, 2023
1 parent 8182651 commit 82bdf69
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions cmd/cli/app/quickstart/quickstart.go
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -275,6 +275,7 @@ var cmd = &cobra.Command{
ctx, cancel = util.GetAppContext()
defer cancel()

alreadyExists := ""
resp, err := client.CreateProfile(ctx, &minderv1.CreateProfileRequest{
Profile: p,
})
Expand All @@ -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
},
}
Expand Down

0 comments on commit 82bdf69

Please sign in to comment.