fix: do not ask for confirmation right after prompting for input

secret set, variable set, team create, webhook create and admin user
create asked a confirmation that defaults to No right after the user
typed the missing values, so pressing Enter discarded the input. They
now submit what the user entered; deletions still confirm.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-11 21:59:18 +02:00
1 parent fcfc497a77
commit b6b3ddc91b
6 files changed
+43 -29

No files matched your search

+2 -6
View File
@@ -76,7 +76,6 @@ func (a *application) adminCommand() *cobra.Command {
command.Flags().BoolVar(&mustChangePassword, "must-change-password", true, "Require password change on next sign-in (use =false to disable)")
}
command.RunE = func(cmd *cobra.Command, args []string) error {
prompted := false
if verb == "create" {
if len(args) > 0 {
if cmd.Flags().Changed("username") {
@@ -88,11 +87,9 @@ func (a *application) adminCommand() *cobra.Command {
value *string
flag string
}{{&username, "username"}, {&email, "email"}} {
completed, err := a.require(cmd, field.value, field.flag)
if err != nil {
if _, err := a.require(cmd, field.value, field.flag); err != nil {
return err
}
prompted = prompted || completed
}
opts.Email = &email
opts.FullName = &fullName
@@ -159,7 +156,6 @@ func (a *application) adminCommand() *cobra.Command {
if password != confirmation {
return clierr.Wrap(clierr.Usage, errors.New("passwords do not match"))
}
prompted = true
}
if password == "" {
return clierr.Wrap(clierr.Usage, errors.New("password cannot be empty"))
@@ -178,7 +174,7 @@ func (a *application) adminCommand() *cobra.Command {
if err != nil {
return err
}
if verb == "delete" || prompted {
if verb == "delete" {
if err := a.confirm(cmd, verb+" account "+username+" on "+target.Host); err != nil {
return err
}