From 14a0ff90f8fde8355031d8f7fd8d1228db97ff6c Mon Sep 17 00:00:00 2001 From: Jim Teeuwen Date: Sat, 16 Nov 2013 12:08:37 +0100 Subject: [PATCH] Adds -o flag to specify output file name. --- config.go | 1 + go-bindata/main.go | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/config.go b/config.go index a45ced8..cbc82f0 100644 --- a/config.go +++ b/config.go @@ -130,6 +130,7 @@ func NewConfig() *Config { c.NoCompress = false c.Debug = false c.Recursive = false + c.Output = "./bindata.go" return c } diff --git a/go-bindata/main.go b/go-bindata/main.go index 77a3185..e7e0817 100644 --- a/go-bindata/main.go +++ b/go-bindata/main.go @@ -34,7 +34,7 @@ func parseArgs() *bindata.Config { c := bindata.NewConfig() flag.Usage = func() { - fmt.Printf("Usage: %s [options] []\n\n", os.Args[0]) + fmt.Printf("Usage: %s [options] \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 }