Skip to content

Commit f38cc37

Browse files
author
Miguel Molina
authored
Merge pull request #100 from erizocosmico/feature/ignored-files-cli
cli: add `exclude` flag to exclude files from generation
2 parents 25c3aa1 + 9d05c29 commit f38cc37

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

generator/cli/kallax/cmd.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@ func main() {
2020
cli.StringFlag{
2121
Name: "input",
2222
Value: ".",
23-
Usage: "input package directory",
23+
Usage: "Input package directory",
2424
},
2525
cli.StringFlag{
2626
Name: "output",
2727
Value: "kallax.go",
28-
Usage: "output file name",
28+
Usage: "Output file name",
29+
},
30+
cli.StringSliceFlag{
31+
Name: "exclude, e",
32+
Usage: "List of excluded files from the package when generating the code for your models. Use this to exclude files in your package that uses the generated code. You can use this flag as many times as you want.",
2933
},
3034
}
3135
app.Action = generateModels
@@ -44,12 +48,13 @@ func main() {
4448
func generateModels(c *cli.Context) error {
4549
input := c.String("input")
4650
output := c.String("output")
51+
excluded := c.StringSlice("exclude")
4752

4853
if !isDirectory(input) {
4954
return fmt.Errorf("kallax: Input path should be a directory %s", input)
5055
}
5156

52-
p := generator.NewProcessor(input, nil)
57+
p := generator.NewProcessor(input, excluded)
5358
pkg, err := p.Do()
5459
if err != nil {
5560
return err

0 commit comments

Comments
 (0)