MCPcopy
hub / github.com/cloudfoundry/cli / ValidateFlags

Method ValidateFlags

command/v7/push_command.go:397–592  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

395}
396
397func (cmd PushCommand) ValidateFlags() error {
398 switch {
399 // Lifecycle buildpack requested
400 case cmd.Lifecycle == constant.AppLifecycleTypeBuildpack && cmd.DockerImage.Path != "":
401 return translatableerror.ArgumentCombinationError{
402 Args: []string{
403 "--lifecycle buildpack",
404 "--docker-image, -o",
405 },
406 }
407
408 case cmd.Lifecycle == constant.AppLifecycleTypeBuildpack && cmd.DockerUsername != "":
409 return translatableerror.ArgumentCombinationError{
410 Args: []string{
411 "--lifecycle buildpack",
412 "--docker-username",
413 },
414 }
415
416 // Lifecycle docker requested
417 case cmd.Lifecycle == constant.AppLifecycleTypeDocker && cmd.Buildpacks != nil:
418 return translatableerror.ArgumentCombinationError{
419 Args: []string{
420 "--lifecycle docker",
421 "--buildpack, -b",
422 },
423 }
424
425 case cmd.Lifecycle == constant.AppLifecycleTypeDocker && cmd.Stack != "":
426 return translatableerror.ArgumentCombinationError{
427 Args: []string{
428 "--lifecycle docker",
429 "--stack, -s",
430 },
431 }
432 case cmd.Lifecycle == constant.AppLifecycleTypeDocker && cmd.DropletPath != "":
433 return translatableerror.ArgumentCombinationError{
434 Args: []string{
435 "--lifecycle docker",
436 "--droplet",
437 },
438 }
439
440 // Lifecycle cnb requested
441 case cmd.Lifecycle == constant.AppLifecycleTypeCNB && cmd.DockerImage.Path != "":
442 return translatableerror.ArgumentCombinationError{
443 Args: []string{
444 "--lifecycle cnb",
445 "--docker-image, -o",
446 },
447 }
448
449 case cmd.Lifecycle == constant.AppLifecycleTypeCNB && cmd.DockerUsername != "":
450 return translatableerror.ArgumentCombinationError{
451 Args: []string{
452 "--lifecycle cnb",
453 "--docker-username",
454 },

Callers 6

ExecuteMethod · 0.95

Calls 4

validBuildpacksMethod · 0.95
MinimumCCAPIVersionCheckFunction · 0.92
validateInstanceStepsFunction · 0.85
APIVersionMethod · 0.65

Tested by

no test coverage detected