Example #1
0
func findDomain(app string, domain string) (api.Domain, error) {
	domains, err := api.DomainsList(app)
	if err != nil {
		return api.Domain{}, errgo.Mask(err)
	}

	for _, d := range domains {
		if d.Name == domain {
			return d, nil
		}
	}
	return api.Domain{}, errgo.New("There is no such domain, please ensure you've added it correctly.\nhttps://my.scalingo.com/apps/" + app + "/domains")
}
Example #2
0
func DomainsRemoveAutoComplete(c *cli.Context) error {
	appName := CurrentAppCompletion(c)
	if appName == "" {
		return nil
	}

	domains, err := api.DomainsList(appName)
	if err == nil {

		for _, domain := range domains {
			fmt.Println(domain.Name)
		}
	}

	return nil
}
Example #3
0
File: list.go Project: yannski/cli
func List(app string) error {
	domains, err := api.DomainsList(app)
	if err != nil {
		return errgo.Mask(err)
	}

	t := tablewriter.NewWriter(os.Stdout)
	t.SetHeader([]string{"Domain", "SSL"})

	for _, domain := range domains {
		if !domain.SSL {
			t.Append([]string{domain.Name, "-"})
		} else {
			t.Append([]string{domain.Name, fmt.Sprintf("Valid until %v", domain.Validity)})
		}
	}
	t.Render()
	return nil
}