Skip to content

Commit

Permalink
Support globbing input paths
Browse files Browse the repository at this point in the history
  • Loading branch information
actgardner committed Apr 8, 2019
1 parent eaf7537 commit b1b6826
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion gogen-avro/config.go
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"os"
"path/filepath"
"strings"
)

Expand Down Expand Up @@ -56,6 +57,15 @@ func parseCmdLine() config {
}

cfg.targetDir = flag.Arg(0)
cfg.files = flag.Args()[1:]
cfg.files = make([]string, 0)

for _, glob := range flag.Args()[1:] {
files, err := filepath.Glob(glob)
if err != nil {
fmt.Fprintf(os.Stderr, "Error parsing input file as glob: %v", err)
os.Exit(1)
}
cfg.files = append(cfg.files, files...)
}
return cfg
}
2 changes: 1 addition & 1 deletion test/complex-arrays-multifile/generate.go
@@ -1,3 +1,3 @@
package avro

//go:generate $GOPATH/bin/gogen-avro . parent.avsc child.avsc
//go:generate $GOPATH/bin/gogen-avro . *.avsc

0 comments on commit b1b6826

Please sign in to comment.