Files
warewulf/internal/app/wwctl/image/delete/main.go
Jonathon Anderson 3c895dd941 Refactor gRPC-based image functions
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2026-03-22 01:02:03 -06:00

29 lines
550 B
Go

package delete
import (
"fmt"
"github.com/warewulf/warewulf/internal/pkg/image"
"github.com/warewulf/warewulf/internal/pkg/util"
"github.com/spf13/cobra"
)
func CobraRunE(cmd *cobra.Command, imageNames []string) (err error) {
if !SetYes {
yes := util.Confirm(fmt.Sprintf("Are you sure you want to delete image %s", imageNames))
if !yes {
return
}
}
for _, imageName := range imageNames {
if err := image.Delete(imageName); err != nil {
return fmt.Errorf("error deleting image %s: %s", imageName, err)
}
}
return nil
}