Exemple #1
0
func (ui *terminalUI) NotifyUpdateIfNeeded(config coreconfig.Reader) {
	if !config.IsMinCLIVersion(cf.Version) {
		ui.Say("")
		ui.Say(T("Cloud Foundry API version {{.APIVer}} requires CLI version {{.CLIMin}}.  You are currently on version {{.CLIVer}}. To upgrade your CLI, please visit: https://github.com/cloudfoundry/cli#downloads",
			map[string]interface{}{
				"APIVer": config.APIVersion(),
				"CLIMin": config.MinCLIVersion(),
				"CLIVer": cf.Version,
			}))
	}
}
Exemple #2
0
func (ui *FakeUI) NotifyUpdateIfNeeded(config coreconfig.Reader) {
	if !config.IsMinCLIVersion(cf.Version) {
		ui.Say("Cloud Foundry API version {{.APIVer}} requires CLI version " + config.MinCLIVersion() + "  You are currently on version {{.CLIVer}}. To upgrade your CLI, please visit: https://github.com/cloudfoundry/cli#downloads")
	}
}
Exemple #3
0
func (ui *terminalUI) ShowConfiguration(config coreconfig.Reader) error {
	var err error
	table := ui.Table([]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() {
		err = table.Print()
		if err != nil {
			return err
		}
		ui.Say(NotLoggedInText())
		return nil
	}

	table.Add(T("User:"******"%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 nil
	}

	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)}),
		)
	}

	err = table.Print()
	if err != nil {
		return err
	}
	return nil
}