(config coreconfig.Reader)
| 173 | } |
| 174 | |
| 175 | func (ui *terminalUI) ShowConfiguration(config coreconfig.Reader) error { |
| 176 | var err error |
| 177 | table := ui.Table([]string{"", ""}) |
| 178 | |
| 179 | if config.HasAPIEndpoint() { |
| 180 | table.Add( |
| 181 | T("API endpoint:"), |
| 182 | T("{{.APIEndpoint}} (API version: {{.APIVersionString}})", |
| 183 | map[string]interface{}{ |
| 184 | "APIEndpoint": EntityNameColor(config.APIEndpoint()), |
| 185 | "APIVersionString": EntityNameColor(config.APIVersion()), |
| 186 | }), |
| 187 | ) |
| 188 | } |
| 189 | |
| 190 | if !config.IsLoggedIn() { |
| 191 | err = table.Print() |
| 192 | if err != nil { |
| 193 | return err |
| 194 | } |
| 195 | ui.Say(NotLoggedInText()) |
| 196 | return nil |
| 197 | } |
| 198 | |
| 199 | table.Add(T("User:"), EntityNameColor(config.UserEmail())) |
| 200 | |
| 201 | if !config.HasOrganization() && !config.HasSpace() { |
| 202 | err = table.Print() |
| 203 | if err != nil { |
| 204 | return err |
| 205 | } |
| 206 | command := fmt.Sprintf("%s target -o ORG -s SPACE", cf.Name) |
| 207 | ui.Say(T("No org or space targeted, use '{{.CFTargetCommand}}'", |
| 208 | map[string]interface{}{ |
| 209 | "CFTargetCommand": CommandColor(command), |
| 210 | })) |
| 211 | return nil |
| 212 | } |
| 213 | |
| 214 | if config.HasOrganization() { |
| 215 | table.Add( |
| 216 | T("Org:"), |
| 217 | EntityNameColor(config.OrganizationFields().Name), |
| 218 | ) |
| 219 | } else { |
| 220 | command := fmt.Sprintf("%s target -o Org", cf.Name) |
| 221 | table.Add( |
| 222 | T("Org:"), |
| 223 | T("No org targeted, use '{{.CFTargetCommand}}'", |
| 224 | map[string]interface{}{ |
| 225 | "CFTargetCommand": CommandColor(command), |
| 226 | }), |
| 227 | ) |
| 228 | } |
| 229 | |
| 230 | if config.HasSpace() { |
| 231 | table.Add( |
| 232 | T("Space:"), |
nothing calls this directly
no test coverage detected