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

     1  package main
     2  
     3  import (
     4  	"github.com/mitchellh/cli"
     5  	"{{ .VCSHost }}/{{ .Owner }}/{{ .Name }}/command"
     6  )
     7  
     8  func Commands(meta *command.Meta) map[string]cli.CommandFactory {
     9  	return map[string]cli.CommandFactory{
    10  		{{ range .Commands }}"{{ .Name }}": func() (cli.Command, error) {
    11  			return &command.{{ title .FunctionName }}Command{
    12  				Meta: *meta,
    13  			}, nil
    14  		},
    15  		{{ end }}
    16  		"version": func() (cli.Command, error) {
    17  			return &command.VersionCommand{
    18  				Meta:     *meta,
    19  				Version:  Version,
    20  				Revision: GitCommit,
    21  				Name: Name,
    22  			}, nil
    23  		},
    24  	}
    25  }