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)