//List all available Locations and optionally apply a filter func List(cmd *cli.Cmd) { provider := cmd.String(cli.StringOpt{ Name: "provider", Desc: "Cloud provider(i.e. amazon)", HideValue: true, }) identifier := cmd.String(cli.StringOpt{ Name: "identifier", Desc: "Cloud provider specific region/zone/etc identifier (i.e. us-east-1)", HideValue: true, }) cmd.Action = func() { l := location.Location{ Provider: *provider, Region: *identifier, } body, errs := l.Find() if len(errs) > 0 { log.Fatalf("Could not retrieve locations: %s", errs[0]) } locations := &[]location.Location{} err := json.Unmarshal([]byte(body), locations) if err != nil { log.Fatal(err) } PrintLocationBrief(*locations) } }