diff --git a/README.md b/README.md index 3ae7bfdddd..407d6af321 100644 --- a/README.md +++ b/README.md @@ -604,6 +604,7 @@ Examples: $ scw ps -f image=alpine $ scw ps -f image=UUIDOFIMAGE $ scw ps -f arch=ARCH + $ scw ps -f server-type=COMMERCIALTYPE $ scw ps -f "state=booted image=docker tags=prod" ``` @@ -1158,6 +1159,7 @@ $ scw inspect myserver | jq '.[0].public_ip.address' ### master (unreleased) +* Support of `scw ps -f server-type=COMMERCIALTYPE` ([#280](https://github.com/scaleway/scaleway-cli/issues/280)) * Support of `scw ps -f arch=XXX` ([#278](https://github.com/scaleway/scaleway-cli/issues/278)) * `scw info` Use json fingerprint field exposed by API * Allow to override Region and Architecture when using the helpers to create a new volume from a human size diff --git a/pkg/cli/cmd_ps.go b/pkg/cli/cmd_ps.go index d1516b6aaa..9e8dc768dc 100644 --- a/pkg/cli/cmd_ps.go +++ b/pkg/cli/cmd_ps.go @@ -33,6 +33,7 @@ var cmdPs = &Command{ $ scw ps -f image=alpine $ scw ps -f image=UUIDOFIMAGE $ scw ps -f arch=ARCH + $ scw ps -f server-type=COMMERCIALTYPE $ scw ps -f "state=booted image=docker tags=prod" `, } diff --git a/pkg/commands/ps.go b/pkg/commands/ps.go index 3476e7722f..363ba808b3 100644 --- a/pkg/commands/ps.go +++ b/pkg/commands/ps.go @@ -45,7 +45,7 @@ func RunPs(ctx CommandContext, args PsArgs) error { for key, value := range args.Filters { switch key { - case "state", "name", "tags", "image", "ip", "arch": + case "state", "name", "tags", "image", "ip", "arch", "server-type": continue default: logrus.Warnf("Unknown filter: '%s=%s'", key, value) @@ -97,6 +97,10 @@ func RunPs(ctx CommandContext, args PsArgs) error { if value != server.Arch { goto skipServer } + case "server-type": + if value != server.CommercialType { + goto skipServer + } } }