diff --git a/cmd/gomote/destroy.go b/cmd/gomote/destroy.go index 86d8cad3c5..7d378641b7 100644 --- a/cmd/gomote/destroy.go +++ b/cmd/gomote/destroy.go @@ -80,6 +80,8 @@ func destroy(args []string) error { } os.Exit(1) } + var destroyGroup bool + fs.BoolVar(&destroyGroup, "destroy-group", false, "if a group is used, destroy the group too") fs.Parse(args) @@ -104,9 +106,15 @@ func destroy(args []string) error { } } if activeGroup != nil { - activeGroup.Instances = nil - if err := storeGroup(activeGroup); err != nil { - return err + if destroyGroup { + if err := deleteGroup(activeGroup.Name); err != nil { + return err + } + } else { + activeGroup.Instances = nil + if err := storeGroup(activeGroup); err != nil { + return err + } } } return nil