From 9fe316ad44fbd582a265fbf0dc01109c884df018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Cluseau?= Date: Wed, 1 Feb 2023 18:51:44 +0100 Subject: [PATCH] bah alors, et les filtres? --- pkg/cmd/applyconfig/applyconfig.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pkg/cmd/applyconfig/applyconfig.go b/pkg/cmd/applyconfig/applyconfig.go index fe7e4f2..130d4b4 100644 --- a/pkg/cmd/applyconfig/applyconfig.go +++ b/pkg/cmd/applyconfig/applyconfig.go @@ -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)