mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-18 20:17:04 +00:00
Feat: don't ask user confirmation when delete with --force or --yes (#4259)
* feature: don't ask user confirmation when delete with --force or --yes Signed-off-by: Sumit Tembe <sumit.tembe@outlook.com> * added a new flag 'yes' * don't skip user confirmation for --force * skip user confirmation for --yes
This commit is contained in:
@@ -78,18 +78,22 @@ func NewDeleteCommand(c common2.Args, order string, ioStreams cmdutil.IOStreams)
|
||||
o.ForceDelete = force
|
||||
userInput := NewUserInput()
|
||||
if svcname == "" {
|
||||
userConfirmation := userInput.AskBool(fmt.Sprintf("Do you want to delete the application %s from namespace %s", o.AppName, o.Namespace), &UserInputOptions{assumeYes})
|
||||
if !userConfirmation {
|
||||
return fmt.Errorf("stopping Deleting")
|
||||
if !assumeYes {
|
||||
userConfirmation := userInput.AskBool(fmt.Sprintf("Do you want to delete the application %s from namespace %s", o.AppName, o.Namespace), &UserInputOptions{assumeYes})
|
||||
if !userConfirmation {
|
||||
return fmt.Errorf("stopping Deleting")
|
||||
}
|
||||
}
|
||||
if err = o.DeleteApp(ioStreams); err != nil {
|
||||
return err
|
||||
}
|
||||
ioStreams.Info(green.Sprintf("app \"%s\" deleted from namespace \"%s\"", o.AppName, o.Namespace))
|
||||
} else {
|
||||
userConfirmation := userInput.AskBool(fmt.Sprintf("Do you want to delete the component %s from application %s in namespace %s", svcname, o.AppName, o.Namespace), &UserInputOptions{assumeYes})
|
||||
if !userConfirmation {
|
||||
return fmt.Errorf("stopping Deleting")
|
||||
if !assumeYes {
|
||||
userConfirmation := userInput.AskBool(fmt.Sprintf("Do you want to delete the component %s from application %s in namespace %s", svcname, o.AppName, o.Namespace), &UserInputOptions{assumeYes})
|
||||
if !userConfirmation {
|
||||
return fmt.Errorf("stopping Deleting")
|
||||
}
|
||||
}
|
||||
o.CompName = svcname
|
||||
if err = o.DeleteComponent(ioStreams); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user