Skip to content

Commit cc28ad0

Browse files
authored
feat(elastic-metal): add color for offer availability (#2854)
1 parent a04acb7 commit cc28ad0

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

internal/namespaces/baremetal/v1/custom.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ func GetCommands() *core.Commands {
1414
))
1515

1616
human.RegisterMarshalerFunc(baremetal.ServerPingStatus(""), human.EnumMarshalFunc(serverPingStatusMarshalSpecs))
17+
human.RegisterMarshalerFunc(baremetal.OfferStock(""), human.EnumMarshalFunc(offerAvailabilityMarshalSpecs))
1718

1819
cmds.MustFind("baremetal", "server", "create").Override(serverCreateBuilder)
1920
cmds.MustFind("baremetal", "server", "install").Override(serverInstallBuilder)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package baremetal
2+
3+
import (
4+
"github.com/fatih/color"
5+
"github.com/scaleway/scaleway-cli/v2/internal/human"
6+
"github.com/scaleway/scaleway-sdk-go/api/baremetal/v1"
7+
)
8+
9+
var (
10+
offerAvailabilityMarshalSpecs = human.EnumMarshalSpecs{
11+
baremetal.OfferStockEmpty: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "empty"},
12+
baremetal.OfferStockLow: &human.EnumMarshalSpec{Attribute: color.FgYellow, Value: "low"},
13+
baremetal.OfferStockAvailable: &human.EnumMarshalSpec{Attribute: color.FgGreen, Value: "available"},
14+
}
15+
)

0 commit comments

Comments
 (0)