Index: tools/proto-gae/proto_gae.go |
diff --git a/tools/proto-gae/proto_gae.go b/tools/proto-gae/proto_gae.go |
index 6db06781b3e1ee3ee3bfcb39f3e37d7f40051e2d..7ec4e5a989da7d647ea66269bdac47588dd1f306 100644 |
--- a/tools/proto-gae/proto_gae.go |
+++ b/tools/proto-gae/proto_gae.go |
@@ -24,6 +24,7 @@ type app struct { |
packageName string |
typeNames stringsetflag.Flag |
outFile string |
+ header string |
} |
const help = `Usage of %s: |
@@ -40,6 +41,11 @@ methods for the named types. |
Options: |
` |
+const copyright = `// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+` |
+ |
func (a *app) parseArgs(fs *flag.FlagSet, args []string) error { |
fs.SetOutput(a.out) |
fs.Usage = func() { |
@@ -51,6 +57,8 @@ func (a *app) parseArgs(fs *flag.FlagSet, args []string) error { |
"A generated proto.Message type to generate stubs for (required, repeatable)") |
fs.StringVar(&a.outFile, "out", "proto_gae.gen.go", |
"The name of the output file") |
+ fs.StringVar(&a.header, "header", copyright, "Header text to put at the top of "+ |
+ "the generated file. Defaults to the Chromium Authors copyright.") |
if err := fs.Parse(args[1:]); err != nil { |
return err |
@@ -74,7 +82,8 @@ func (a *app) parseArgs(fs *flag.FlagSet, args []string) error { |
} |
var tmpl = template.Must( |
- template.New("main").Parse(`// AUTOGENERATED: Do not edit |
+ template.New("main").Parse(`{{if index . "header"}}{{index . "header"}} |
+{{end}}// AUTOGENERATED: Do not edit |
package {{index . "package"}} |
@@ -115,6 +124,7 @@ func (a *app) writeTo(w io.Writer) error { |
return tmpl.Execute(w, map[string]interface{}{ |
"package": a.packageName, |
"types": typeNames, |
+ "header": a.header, |
}) |
} |