add SetYes to node delete command

This commit is contained in:
Cooper, Trevor
2021-04-15 08:05:28 -07:00
parent 505ee9f32a
commit b7908d8747
2 changed files with 16 additions and 11 deletions

View File

@@ -31,19 +31,22 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
if count > 0 {
q := fmt.Sprintf("Are you sure you want to delete %d nodes(s)", count)
prompt := promptui.Prompt{
Label: q,
IsConfirm: true,
}
result, _ := prompt.Run()
if result == "y" || result == "yes" {
if SetYes == true {
nodeDB.Persist()
}
} else {
q := fmt.Sprintf("Are you sure you want to delete %d nodes(s)", count)
prompt := promptui.Prompt{
Label: q,
IsConfirm: true,
}
result, _ := prompt.Run()
if result == "y" || result == "yes" {
nodeDB.Persist()
}
}
} else {
fmt.Printf("No nodes found\n")
}