MCPcopy Index your code
hub / github.com/cloudfoundry/cli / autoTargetSpace

Method autoTargetSpace

command/v7/target_command.go:116–129  ·  view source on GitHub ↗

autoTargetSpace targets the space if there is only one space in the org and no space arg was provided.

(orgGUID string)

Source from the content-addressed store, hash-verified

114// autoTargetSpace targets the space if there is only one space in the org
115// and no space arg was provided.
116func (cmd *TargetCommand) autoTargetSpace(orgGUID string) error {
117 spaces, warnings, err := cmd.Actor.GetOrganizationSpaces(orgGUID)
118 cmd.UI.DisplayWarnings(warnings)
119 if err != nil {
120 return err
121 }
122
123 if len(spaces) == 1 {
124 space := spaces[0]
125 cmd.Config.V7SetSpaceInformation(space.GUID, space.Name)
126 }
127
128 return nil
129}
130
131// setSpace sets space
132func (cmd *TargetCommand) setSpace() error {

Callers 1

ExecuteMethod · 0.95

Calls 3

GetOrganizationSpacesMethod · 0.65
DisplayWarningsMethod · 0.65
V7SetSpaceInformationMethod · 0.65

Tested by

no test coverage detected