示例#1
0
func callShowSpace(t *testing.T, args []string, reqFactory *testreq.FakeReqFactory, config *configuration.Configuration) (ui *testterm.FakeUI) {
	ui = new(testterm.FakeUI)
	ctxt := testcmd.NewContext("space", args)

	token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
		Username: "******",
	})
	assert.NoError(t, err)

	config.Organization = cf.Organization{Name: "my-org"}
	config.AccessToken = token

	cmd := NewShowSpace(ui, config)
	testcmd.RunCommand(cmd, ctxt, reqFactory)
	return
}
示例#2
0
文件: services_test.go 项目: nsnt/cli
func createServiceRepoWithConfig(t *testing.T, reqs []testnet.TestRequest, config *configuration.Configuration) (ts *httptest.Server, handler *testnet.TestHandler, repo ServiceRepository) {
	if len(reqs) > 0 {
		ts, handler = testnet.NewTLSServer(t, reqs)
		config.Target = ts.URL
	}

	gateway := net.NewCloudControllerGateway()
	repo = NewCloudControllerServiceRepository(config, gateway)
	return
}
示例#3
0
文件: login.go 项目: KaiYoung/cli
func (l Login) saveSpace(config *configuration.Configuration, space cf.Space) (err error) {
	config.Space = space
	err = l.configRepo.Save()

	if err != nil {
		l.ui.Failed("Error saving organization: %s", err)
		return
	}

	return
}
示例#4
0
文件: login.go 项目: KaiYoung/cli
func (l Login) saveOrg(config *configuration.Configuration, org cf.Organization) (err error) {
	config.Organization = org
	err = l.configRepo.Save()

	if err != nil {
		l.ui.Failed("Error saving organization: %s", err)
		return
	}

	return
}
示例#5
0
文件: ui.go 项目: KaiYoung/cli
func (ui TerminalUI) ShowConfiguration(config *configuration.Configuration) {
	ui.Say("API endpoint: %s (API version: %s)",
		Yellow(config.Target),
		Yellow(config.ApiVersion))

	if !config.IsLoggedIn() {
		ui.Say("Logged out. Use '%s' to login.", Yellow("cf login USERNAME"))
	} else {
		ui.Say("user:            %s", Yellow(config.UserEmail()))
	}

	if config.HasOrganization() {
		ui.Say("org:             %s", Yellow(config.Organization.Name))
	}

	if config.HasSpace() {
		ui.Say("app space:       %s", Yellow(config.Space.Name))
	}
}
示例#6
0
文件: ui.go 项目: pmuellr/cli
func (ui terminalUI) ShowConfiguration(config *configuration.Configuration) {
	ui.Say("API endpoint: %s (API version: %s)",
		EntityNameColor(config.Target),
		EntityNameColor(config.ApiVersion))

	if !config.IsLoggedIn() {
		ui.Say(NotLoggedInText())
	} else {
		ui.Say("User:         %s", EntityNameColor(config.UserEmail()))
	}

	if config.HasOrganization() {
		ui.Say("Org:          %s", EntityNameColor(config.OrganizationFields.Name))
	}

	if config.HasSpace() {
		ui.Say("Space:        %s", EntityNameColor(config.SpaceFields.Name))
	}
}
示例#7
0
文件: ui.go 项目: jalateras/cli
func (ui terminalUI) ShowConfiguration(config *configuration.Configuration) {
	ui.Say("API endpoint: %s (API version: %s)",
		EntityNameColor(config.Target),
		EntityNameColor(config.ApiVersion))

	if !config.IsLoggedIn() {
		ui.Say("Logged out, use '%s' to login", CommandColor(cf.Name()+" login USERNAME"))
	} else {
		ui.Say("User:         %s", EntityNameColor(config.UserEmail()))
	}

	if config.HasOrganization() {
		ui.Say("Org:          %s", EntityNameColor(config.Organization.Name))
	}

	if config.HasSpace() {
		ui.Say("Space:        %s", EntityNameColor(config.Space.Name))
	}
}