Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update quickstart command message layout #1696

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading