github.com/tcnksm/gcli@v0.2.4-0.20170129033839-7eb950507e5a/skeleton/resource/tmpl/go_cmd/command.go.tmpl (about)

     1  package main
     2  
     3  var cmd{{ title .FunctionName }} = &Command{
     4  	Run:       run{{ title .FunctionName }},
     5  	UsageLine: "{{ .Name }} ",
     6  	Short:     "{{ .Synopsis }}",
     7  	Long: `
     8  {{ .Help }}
     9  	`,
    10  }
    11  
    12  func init(){
    13  	// Set your flag here like below.
    14  	// cmd{{ title .Name }}.Flag.BoolVar(&flagA, "a", false, "")
    15  }
    16  
    17  // run{{ title .FunctionName }} executes {{ .Name }} command and return exit code. 
    18  func run{{ title .FunctionName }}(args []string) int {
    19  	{{ if ne .DebugOutput "" }}print("{{ .DebugOutput }}"){{ end }}
    20  	return 0
    21  }