github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/actor/v7pushaction/handle_droplet_path_override.go (about)

     1  package v7pushaction
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/command/translatableerror"
     5  	"code.cloudfoundry.org/cli/util/manifestparser"
     6  )
     7  
     8  func HandleDropletPathOverride(manifest manifestparser.Manifest, overrides FlagOverrides) (manifestparser.Manifest, error) {
     9  	if overrides.DropletPath != "" {
    10  		if manifest.ContainsMultipleApps() {
    11  			return manifest, translatableerror.CommandLineArgsWithMultipleAppsError{}
    12  		}
    13  
    14  		app := manifest.GetFirstApp()
    15  
    16  		if app.Docker != nil {
    17  			return manifest, translatableerror.ArgumentManifestMismatchError{
    18  				Arg:              "--droplet",
    19  				ManifestProperty: "docker",
    20  			}
    21  		}
    22  
    23  		if app.Path != "" {
    24  			return manifest, translatableerror.ArgumentManifestMismatchError{
    25  				Arg:              "--droplet",
    26  				ManifestProperty: "path",
    27  			}
    28  		}
    29  
    30  		if app.HasBuildpacks() {
    31  			return manifest, translatableerror.ArgumentManifestMismatchError{
    32  				Arg:              "--droplet",
    33  				ManifestProperty: "buildpacks",
    34  			}
    35  		}
    36  	}
    37  
    38  	return manifest, nil
    39  }