浏览代码

generator: Clarify cli usage for specifying plugins

Including the ability to specify plugins as cli args, and the
possibility of giving builtin plugins as shortnames

Signed-off-by: Anatole Denis <anatole@unverle.fr>
Anatole Denis 5 年之前
父节点
当前提交
fa4a1c197d
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      cmds/coredhcp-generator/main.go

+ 13 - 0
cmds/coredhcp-generator/main.go

@@ -37,8 +37,21 @@ var funcMap = template.FuncMap{
 	},
 }
 
+func usage() {
+	fmt.Fprintf(flag.CommandLine.Output(),
+		"%s [-template tpl] [-outfile out] [-from pluginlist] [plugin [plugin...]]\n",
+		os.Args[0],
+	)
+	flag.PrintDefaults()
+	fmt.Fprintln(flag.CommandLine.Output(), `  plugin
+	Plugin name to include, as go import path.
+	Short names can be used for builtin coredhcp plugins (eg "serverid")`)
+}
+
 func main() {
+	flag.Usage = usage
 	flag.Parse()
+
 	data, err := ioutil.ReadFile(*flagTemplate)
 	if err != nil {
 		log.Fatalf("Failed to read template file '%s': %v", *flagTemplate, err)