示例#1
0
文件: push.go 项目: nsnt/cli
func (cmd *Push) domain(c *cli.Context, domainName string) (domain cf.Domain) {
	var apiResponse net.ApiResponse

	if domainName != "" {
		domain, apiResponse = cmd.domainRepo.FindByNameInCurrentSpace(domainName)
		if apiResponse.IsNotSuccessful() {
			cmd.ui.Failed(apiResponse.Message)
		}
		return
	}

	apiResponse = cmd.domainRepo.ListSharedDomains(api.ListDomainsCallback(func(domains []cf.Domain) bool {
		domain = domains[0]
		return false
	}))

	if apiResponse.IsNotSuccessful() {
		cmd.ui.Failed(apiResponse.Message)
	}

	if domain.Guid == "" {
		cmd.ui.Failed("No default domain exists")
	}

	return
}
示例#2
0
文件: list_domains.go 项目: nsnt/cli
func domainsCallback(status string, table terminal.Table, noDomains *bool) api.ListDomainsCallback {
	return api.ListDomainsCallback(func(domains []cf.Domain) bool {
		rows := [][]string{}
		for _, domain := range domains {
			rows = append(rows, []string{domain.Name, status})
		}
		table.Print(rows)
		*noDomains = false
		return true
	})
}