github.com/jenspinney/cli@v6.42.1-0.20190207184520-7450c600020e+incompatible/command/common/version_command.go (about)

     1  package common
     2  
     3  import "code.cloudfoundry.org/cli/command"
     4  
     5  type VersionCommand struct {
     6  	usage  interface{} `usage:"CF_NAME version\n\n   'cf -v' and 'cf --version' are also accepted."`
     7  	UI     command.UI
     8  	Config command.Config
     9  }
    10  
    11  func (cmd *VersionCommand) Setup(config command.Config, ui command.UI) error {
    12  	cmd.UI = ui
    13  	cmd.Config = config
    14  	return nil
    15  }
    16  
    17  func (cmd VersionCommand) Execute(args []string) error {
    18  	cmd.UI.DisplayText("{{.BinaryName}} version {{.VersionString}}",
    19  		map[string]interface{}{
    20  			"BinaryName":    cmd.Config.BinaryName(),
    21  			"VersionString": cmd.Config.BinaryVersion(),
    22  		})
    23  
    24  	return nil
    25  }