github.com/ablease/cli@v6.37.1-0.20180613014814-3adbb7d7fb19+incompatible/command/minimum_version_check.go (about)

     1  package command
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/command/translatableerror"
     5  )
     6  
     7  func MinimumAPIVersionCheck(current string, minimum string, customCommand ...string) error {
     8  	var command string
     9  	if len(customCommand) > 0 {
    10  		command = customCommand[0]
    11  	}
    12  
    13  	isOutdated, err := checkVersionOutdated(current, minimum)
    14  	if err != nil {
    15  		return err
    16  	}
    17  
    18  	if isOutdated {
    19  		return translatableerror.MinimumAPIVersionNotMetError{
    20  			Command:        command,
    21  			CurrentVersion: current,
    22  			MinimumVersion: minimum,
    23  		}
    24  	}
    25  
    26  	return nil
    27  }