fix: add correct flags when deleting resources from Dir (#2124)

mine
Daniel Vedsmand 2023-06-14 15:59:20 +02:00 committed by GitHub
parent c4ef6006bd
commit 25a99d3f3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -229,13 +229,23 @@ func (d *Dir) delCmd(evt *tcell.EventKey) *tcell.EventKey {
return evt
}
opts := []string{"-f"}
msgRessource := "manifest"
if containsDir(sel) {
opts = append(opts, "-R")
}
if isKustomized(sel) {
opts = []string{"-k"}
msgRessource = "kustomization"
}
d.Stop()
defer d.Start()
msg := fmt.Sprintf("Delete resource(s) in manifest %s", sel)
msg := fmt.Sprintf("Delete resource(s) in %s %s", msgRessource, sel)
dialog.ShowConfirm(d.App().Styles.Dialog(), d.App().Content.Pages, "Confirm Delete", msg, func() {
args := make([]string, 0, 10)
args = append(args, "delete")
args = append(args, "-f")
args = append(args, opts...)
args = append(args, sel)
res, err := runKu(d.App(), shellOpts{clear: false, args: args})
if err != nil {