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

Method ShowConfiguration

cf/terminal/ui.go:175–248  ·  view source on GitHub ↗
(config coreconfig.Reader)

Source from the content-addressed store, hash-verified

173}
174
175func (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:"),

Callers

nothing calls this directly

Calls 15

TableMethod · 0.95
SayMethod · 0.95
EntityNameColorFunction · 0.85
NotLoggedInTextFunction · 0.85
CommandColorFunction · 0.85
HasAPIEndpointMethod · 0.65
AddMethod · 0.65
APIEndpointMethod · 0.65
APIVersionMethod · 0.65
IsLoggedInMethod · 0.65
PrintMethod · 0.65
UserEmailMethod · 0.65

Tested by

no test coverage detected