mirror of https://github.com/markbates/pkger.git
feat: -exclude flag list command
This commit is contained in:
parent
f3870921de
commit
43f475ac07
|
@ -19,6 +19,7 @@ type listCmd struct {
|
||||||
help bool
|
help bool
|
||||||
json bool
|
json bool
|
||||||
include slice
|
include slice
|
||||||
|
exclude slice
|
||||||
subs []command
|
subs []command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ func (e *listCmd) Exec(args []string) error {
|
||||||
fp := filepath.Join(info.Dir, outName)
|
fp := filepath.Join(info.Dir, outName)
|
||||||
os.RemoveAll(fp)
|
os.RemoveAll(fp)
|
||||||
|
|
||||||
decls, err := parser.Parse(info, e.include, nil)
|
decls, err := parser.Parse(info, e.include, e.exclude)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -95,6 +96,7 @@ func (e *listCmd) Flags() *flag.FlagSet {
|
||||||
e.FlagSet = flag.NewFlagSet("list", flag.ExitOnError)
|
e.FlagSet = flag.NewFlagSet("list", flag.ExitOnError)
|
||||||
e.BoolVar(&e.json, "json", false, "prints in JSON format")
|
e.BoolVar(&e.json, "json", false, "prints in JSON format")
|
||||||
e.Var(&e.include, "include", "packages the specified file or directory")
|
e.Var(&e.include, "include", "packages the specified file or directory")
|
||||||
|
e.Var(&e.exclude, "exclude", "exclude files or directories from parsing")
|
||||||
}
|
}
|
||||||
e.Usage = Usage(os.Stderr, e.FlagSet)
|
e.Usage = Usage(os.Stderr, e.FlagSet)
|
||||||
return e.FlagSet
|
return e.FlagSet
|
||||||
|
|
Loading…
Reference in New Issue