Skip to content

Commit

Permalink
Confirm enrolling a provider org (#1503)
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
  • Loading branch information
rdimitrov authored Nov 6, 2023
1 parent ec58b5c commit ccc3401
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/cli/app/provider/provider_enroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ actions such as adding repositories.`,
pat := util.GetConfigValue(viper.GetViper(), "token", "token", cmd, "").(string)
owner := util.GetConfigValue(viper.GetViper(), "owner", "owner", cmd, "").(string)

// Ask for confirmation if an owner is set on purpose
ownerPromptStr := "your personal account"
if owner != "" {
ownerPromptStr = fmt.Sprintf("the %s organisation", owner)
}
yes := cli.PrintYesNoPrompt(cmd,
fmt.Sprintf("You are about to enroll repositories from %s. Confirm? (yes/no): \n", ownerPromptStr),
"Enroll operation cancelled.")
if !yes {
return
}

conn, err := util.GrpcForCommand(cmd, viper.GetViper())
util.ExitNicelyOnError(err, "Error getting grpc connection")
defer conn.Close()
Expand Down

0 comments on commit ccc3401

Please sign in to comment.