github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/command/api_version_warning.go (about) 1 package command 2 3 import ( 4 "code.cloudfoundry.org/cli/command/translatableerror" 5 ) 6 7 func WarnAPIVersionCheck(config Config, ui UI) error { 8 // TODO: make private and refactor commands that use 9 err := MinimumAPIVersionCheck(config.BinaryVersion(), config.MinCLIVersion()) 10 11 if _, ok := err.(translatableerror.MinimumAPIVersionNotMetError); ok { 12 ui.DisplayWarning("Cloud Foundry API version {{.APIVersion}} requires CLI version {{.MinCLIVersion}}. You are currently on version {{.BinaryVersion}}. To upgrade your CLI, please visit: https://github.com/cloudfoundry/cli#downloads", 13 map[string]interface{}{ 14 "APIVersion": config.APIVersion(), 15 "MinCLIVersion": config.MinCLIVersion(), 16 "BinaryVersion": config.BinaryVersion(), 17 }) 18 ui.DisplayNewline() 19 return nil 20 } 21 22 // Only error if there was an issue in parsing versions 23 return err 24 }