autoTargetSpace targets the space if there is only one space in the org and no space arg was provided.
(orgGUID string)
| 114 | // autoTargetSpace targets the space if there is only one space in the org |
| 115 | // and no space arg was provided. |
| 116 | func (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 |
| 132 | func (cmd *TargetCommand) setSpace() error { |
no test coverage detected