Skip to content

Commit

Permalink
Add emoji for Country Code flags (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdavid authored Mar 4, 2023
1 parent 3a18814 commit f7555ff
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ The following subcomponents are used:
* License: [BSD-3-Clause](https://github.com/inhies/go-bytesize/blob/4913239db9cf/LICENSE)


## github.com/jayco/go-emoji-flag

* Name: github.com/jayco/go-emoji-flag
* Version: v0.0.0-20190810054606-01604da018da
* License: [MIT](https://github.com/jayco/go-emoji-flag/blob/01604da018da/LICENSE)


## github.com/magiconair/properties

* Name: github.com/magiconair/properties
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ require (
github.com/huandu/xstrings v1.4.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jayco/go-emoji-flag v0.0.0-20190810054606-01604da018da // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf h1:FtEj8sfIcaaBfAKrE1Cwb61YDtYq9JxChK1c7AKce7s=
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf/go.mod h1:yrqSXGoD/4EKfF26AOGzscPOgTTJcyAwM2rpixWT+t4=
github.com/jayco/go-emoji-flag v0.0.0-20190810054606-01604da018da h1:dNcal61X/1i7TdXROmomj0q4C+2gmt/o3Ysmj7vIZ7U=
github.com/jayco/go-emoji-flag v0.0.0-20190810054606-01604da018da/go.mod h1:HJ4F3CTjbbQTxnXSttu5qM+iH0GClyvCfH243F/bReo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
Expand Down
5 changes: 3 additions & 2 deletions internal/formatter/cloud_regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ package formatter
import (
"encoding/json"

emoji "github.com/jayco/go-emoji-flag"
ybmclient "github.com/yugabyte/yugabytedb-managed-go-client-internal"
)

const (
defaulCloudRegionListing = "table {{.RegionName}}\t{{.RegionCode}}\t{{.CountryCode}}"
regionNameHeader = "Region Name"
regionCodeHeader = "Region Code"
countryCodeHeader = "Country Code"
countryCodeHeader = "Country"
)

type CloudRegionContext struct {
Expand Down Expand Up @@ -78,7 +79,7 @@ func (c *CloudRegionContext) RegionCode() string {
}

func (c *CloudRegionContext) CountryCode() string {
return c.c.GetCountryCode()
return emoji.GetFlag(c.c.GetCountryCode()) + " " + c.c.GetCountryCode()
}

func (c *CloudRegionContext) MarshalJSON() ([]byte, error) {
Expand Down

0 comments on commit f7555ff

Please sign in to comment.