Adds -o flag to specify output file name.

This commit is contained in:
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.NoCompress = false
c.Debug = false c.Debug = false
c.Recursive = false c.Recursive = false
c.Output = "./bindata.go"
return c return c
} }

View File

@ -34,7 +34,7 @@ func parseArgs() *bindata.Config {
c := bindata.NewConfig() c := bindata.NewConfig()
flag.Usage = func() { 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() 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.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.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.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.BoolVar(&version, "version", false, "Displays version information.")
flag.Parse() flag.Parse()
@ -60,12 +61,7 @@ func parseArgs() *bindata.Config {
} }
input := filepath.Clean(flag.Arg(0)) input := filepath.Clean(flag.Arg(0))
c.Input = []bindata.InputConfig{parseInput(input)} c.Input = []bindata.InputConfig{parseInput(input)}
if flag.NArg() > 1 {
c.Output = filepath.Clean(flag.Arg(1))
}
return c return c
} }