本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/configuration/core_config.Reader.HasSpace方法的典型用法代码示例。如果您正苦于以下问题:Golang Reader.HasSpace方法的具体用法?Golang Reader.HasSpace怎么用?Golang Reader.HasSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/cli/cf/configuration/core_config.Reader
的用法示例。
在下文中一共展示了Reader.HasSpace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ShowConfiguration
func (ui *terminalUI) ShowConfiguration(config core_config.Reader) {
table := NewTable(ui, []string{"", ""})
if config.HasAPIEndpoint() {
table.Add(
T("API endpoint:"),
T("{{.ApiEndpoint}} (API version: {{.ApiVersionString}})",
map[string]interface{}{
"ApiEndpoint": EntityNameColor(config.ApiEndpoint()),
"ApiVersionString": EntityNameColor(config.ApiVersion()),
}),
)
}
if !config.IsLoggedIn() {
table.Print()
ui.Say(NotLoggedInText())
return
} else {
table.Add(
T("User:"),
EntityNameColor(config.UserEmail()),
)
}
if !config.HasOrganization() && !config.HasSpace() {
table.Print()
command := fmt.Sprintf("%s target -o ORG -s SPACE", cf.Name())
ui.Say(T("No org or space targeted, use '{{.CFTargetCommand}}'",
map[string]interface{}{
"CFTargetCommand": CommandColor(command),
}))
return
}
if config.HasOrganization() {
table.Add(
T("Org:"),
EntityNameColor(config.OrganizationFields().Name),
)
} else {
command := fmt.Sprintf("%s target -o Org", cf.Name())
table.Add(
T("Org:"),
T("No org targeted, use '{{.CFTargetCommand}}'",
map[string]interface{}{
"CFTargetCommand": CommandColor(command),
}),
)
}
if config.HasSpace() {
table.Add(
T("Space:"),
EntityNameColor(config.SpaceFields().Name),
)
} else {
command := fmt.Sprintf("%s target -s SPACE", cf.Name())
table.Add(
T("Space:"),
T("No space targeted, use '{{.CFTargetCommand}}'", map[string]interface{}{"CFTargetCommand": CommandColor(command)}),
)
}
table.Print()
}