Skip to content

Commit

Permalink
Merge pull request #374 from civo/region-bug
Browse files Browse the repository at this point in the history
Fixes #373:  region ls cmd inconsistency
  • Loading branch information
uzaxirr authored Mar 21, 2024
2 parents c76243c + 1fb3e91 commit b227728
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions cmd/region/region_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,16 @@ Example: civo region ls -o custom -f "Code: Name (Region)"`,
ow.AppendDataWithLabel("name", region.Name, "Name")
ow.AppendDataWithLabel("country", region.CountryName, "Country")

defaultLabel := ""
if common.OutputFormat == "json" || common.OutputFormat == "custom" {
defaultLabel = utility.BoolToYesNo(region.Default)
isCurrent := strings.ToLower(region.Code) == strings.ToLower(config.Current.Meta.DefaultRegion)
ow.AppendDataWithLabel("current", utility.BoolToYesNo(isCurrent), "Current")
} else {
if config.Current.Meta.DefaultRegion != "" {
if strings.ToLower(region.Code) == strings.ToLower(config.Current.Meta.DefaultRegion) {
defaultLabel = "<====="
}
} else {
if region.Default {
defaultLabel = "<====="
}
defaultLabel := ""
if config.Current.Meta.DefaultRegion != "" && strings.ToLower(region.Code) == strings.ToLower(config.Current.Meta.DefaultRegion) {
defaultLabel = "<====="
}

ow.AppendDataWithLabel("current", defaultLabel, "Current")
}
ow.AppendDataWithLabel("current", defaultLabel, "Current")
}

switch common.OutputFormat {
Expand Down

0 comments on commit b227728

Please sign in to comment.