github.com/lukasheimann/cloudfoundrycli@v7.1.0+incompatible/command/translatableerror/argument_manifest_mismatch_error.go (about)

     1  package translatableerror
     2  
     3  // ArgumentManifestMismatchError represent an error caused by using a command line flag
     4  // that conflicts with a given manifest property.
     5  type ArgumentManifestMismatchError struct {
     6  	Arg              string
     7  	ManifestProperty string
     8  	ManifestValue    string
     9  }
    10  
    11  func (ArgumentManifestMismatchError) DisplayUsage() {}
    12  
    13  func (e ArgumentManifestMismatchError) Error() string {
    14  	if e.ManifestValue == "" {
    15  		return "Incorrect Usage: The flag option {{.Arg}} cannot be used with the manifest property {{.Property}}"
    16  	}
    17  	return "Incorrect Usage: The flag option {{.Arg}} cannot be used with the manifest property {{.Property}} set to {{.ManifestValue}}"
    18  }
    19  
    20  func (e ArgumentManifestMismatchError) Translate(translate func(string, ...interface{}) string) string {
    21  	return translate(e.Error(), map[string]interface{}{
    22  		"Arg":           e.Arg,
    23  		"Property":      e.ManifestProperty,
    24  		"ManifestValue": e.ManifestValue,
    25  	})
    26  }