feat: -exclude flag list command

This commit is contained in:
Jan Kaßel 2020-07-22 15:24:19 +02:00
parent f3870921de
commit 43f475ac07
1 changed files with 3 additions and 1 deletions

View File

@ -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