overlay.GetOverlay(name) returns now an error if the overlay doesn't exist. This is the most canonical way to act if there is no overlay.
21 lines
365 B
Go
21 lines
365 B
Go
package delete
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
"github.com/warewulf/warewulf/internal/pkg/overlay"
|
|
)
|
|
|
|
func CobraRunE(cmd *cobra.Command, args []string) error {
|
|
|
|
fileName := ""
|
|
if len(args) == 2 {
|
|
fileName = args[1]
|
|
}
|
|
|
|
myOverlay, err := overlay.GetOverlay(args[0])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return myOverlay.DeleteFile(fileName, Force, Parents)
|
|
}
|