Adds -o flag to specify output file name.

pull/4/head
Jim Teeuwen 2013-11-16 12:08:37 +01:00
parent 67221add2e
commit 14a0ff90f8
2 changed files with 3 additions and 6 deletions

View File

@ -130,6 +130,7 @@ func NewConfig() *Config {
c.NoCompress = false
c.Debug = false
c.Recursive = false
c.Output = "./bindata.go"
return c
}

View File

@ -34,7 +34,7 @@ func parseArgs() *bindata.Config {
c := bindata.NewConfig()
flag.Usage = func() {
fmt.Printf("Usage: %s [options] <input dir> [<output file>]\n\n", os.Args[0])
fmt.Printf("Usage: %s [options] <input directories>\n\n", os.Args[0])
flag.PrintDefaults()
}
@ -44,6 +44,7 @@ func parseArgs() *bindata.Config {
flag.StringVar(&c.Package, "pkg", c.Package, "Package name to use in the generated code.")
flag.BoolVar(&c.NoMemCopy, "nomemcopy", c.NoMemCopy, "Use a .rodata hack to get rid of unnecessary memcopies. Refer to the documentation to see what implications this carries.")
flag.BoolVar(&c.NoCompress, "nocompress", c.NoCompress, "Assets will *not* be GZIP compressed when this flag is specified.")
flag.StringVar(&c.Output, "o", c.Output, "Optional name of the output file to be generated.")
flag.BoolVar(&version, "version", false, "Displays version information.")
flag.Parse()
@ -60,12 +61,7 @@ func parseArgs() *bindata.Config {
}
input := filepath.Clean(flag.Arg(0))
c.Input = []bindata.InputConfig{parseInput(input)}
if flag.NArg() > 1 {
c.Output = filepath.Clean(flag.Arg(1))
}
return c
}