bah alors, et les filtres?

This commit is contained in:
Mikaël Cluseau 2023-02-01 18:51:44 +01:00
parent e9ba7987b8
commit 9fe316ad44

View File

@ -1,9 +1,7 @@
package applyconfig
import (
"flag"
"os"
"strings"
"github.com/spf13/cobra"
"novit.nc/direktil/inits/pkg/apply"
@ -13,8 +11,8 @@ import (
)
var (
filesFilters string
log = dlog.Get("dkl")
filters []string
log = dlog.Get("dkl")
)
func Command() (c *cobra.Command) {
@ -26,7 +24,8 @@ func Command() (c *cobra.Command) {
Run: run,
}
flag.StringVar(&filesFilters, "files-filters", "", "comma-separated filters to select files to apply")
flag := c.Flags()
flag.StringArrayVarP(&filters, "filter", "F", []string{}, "glob filter to select files to apply")
return c
}
@ -52,10 +51,6 @@ func run(_ *cobra.Command, args []string) {
log.Print("failed to load config: ", err)
}
filters := []string{}
if filesFilters != "" {
filters = strings.Split(filesFilters, ",")
}
if err = apply.Files(cfg /*log,*/, filters...); err != nil {
log.Taint(dlog.Fatal, "failed to apply files: ", err)
os.Exit(1)