Skip to content

docs: add section for command namespaces #4620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 58 additions & 33 deletions cmd/scw/testdata/test-main-usage-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,79 @@
USAGE:
scw <command>

AVAILABLE COMMANDS:
account This API allows you to manage your Scaleway Projects
AI COMMANDS:
inference This API allows you to manage your Inference services

BAREMETAL COMMANDS:
apple-silicon Apple silicon API
audit-trail This API allows you to ensure accountability and security by recording events and changes performed within your Scaleway Organization.
autocomplete Autocomplete related commands
baremetal Elastic Metal API
billing This API allows you to manage and query your Scaleway billing and consumption
block This API allows you to manage your Block Storage volumes
cockpit This API allows you to manage your Scaleway Cockpit, for storing and visualizing metrics and logs
container This API allows you to manage your Serverless Containers
dns This API allows you to manage your domains, DNS zones and records
document-db This API allows you to manage your Document Databases
edge-services Edge Services API
fip This API allows you to manage your Elastic Metal servers' flexible public IP addresses
function Function as a Service API
help Get help about how the CLI works
iam This API allows you to manage Identity and Access Management (IAM) across your Scaleway Organizations, Projects and resources
inference This API allows you to manage your Inference services

COMPUTE COMMANDS:
instance This API allows you to manage your Instances
interlink This API allows you to manage your InterLink services
iot This API allows you to manage your IoT hubs and devices
ipam This API allows you to manage your Scaleway IP addresses with our IP Address Management tool
jobs This API allows you to manage your Serverless Jobs
k8s This API allows you to manage Kubernetes Kapsule and Kosmos clusters
keymanager Key Manager API
lb This API allows you to manage your Scaleway Load Balancer services
marketplace This API allows you to find available images for use when launching a Scaleway Instance
mnq These APIs allow you to manage your Messaging and Queuing NATS, Queues and Topics and Events services

CONFIGURATION COMMANDS:
alias Alias related commands
config Config file management
info Get info about current settings
init Initialize the config
login Login to scaleway

CONTAINER COMMANDS:
k8s This API allows you to manage Kubernetes Kapsule and Kosmos clusters
registry This API allows you to manage your Container Registry resources

COST COMMANDS:
billing This API allows you to manage and query your Scaleway billing and consumption

DATABASE COMMANDS:
document-db This API allows you to manage your Document Databases
mongodb This API allows you to manage your Managed Databases for MongoDB®
object Object-storage utils
rdb This API allows you to manage your Managed Databases for PostgreSQL and MySQL
redis This API allows you to manage your Managed Databases for Redis™
registry This API allows you to manage your Container Registry resources
sdb-sql This API allows you to manage your Serverless SQL Databases
secret Secret Manager API

DOMAIN & WEBHOSTING COMMANDS:
dns This API allows you to manage your domains, DNS zones and records
tem This API allows you to manage your Transactional Email services
webhosting This API allows you to manage your Web Hosting services

INTEGRATION COMMANDS:
iot This API allows you to manage your IoT hubs and devices
mnq These APIs allow you to manage your Messaging and Queuing NATS, Queues and Topics and Events services

MONITORING COMMANDS:
audit-trail This API allows you to ensure accountability and security by recording events and changes performed within your Scaleway Organization.
cockpit This API allows you to manage your Scaleway Cockpit, for storing and visualizing metrics and logs

NETWORK COMMANDS:
edge-services Edge Services API
interlink This API allows you to manage your InterLink services
ipam This API allows you to manage your Scaleway IP addresses with our IP Address Management tool
lb This API allows you to manage your Scaleway Load Balancer services
vpc This API allows you to manage your Virtual Private Clouds (VPCs) and Private Networks
vpc-gw This API allows you to manage your Public Gateways
webhosting This API allows you to manage your Web Hosting services

CONFIGURATION COMMANDS:
alias Alias related commands
config Config file management
info Get info about current settings
init Initialize the config
login Login to scaleway
SECURITY COMMANDS:
account This API allows you to manage your Scaleway Projects
audit-trail This API allows you to ensure accountability and security by recording events and changes performed within your Scaleway Organization.
iam This API allows you to manage Identity and Access Management (IAM) across your Scaleway Organizations, Projects and resources
keymanager Key Manager API
secret Secret Manager API

SERVERLESS COMMANDS:
container This API allows you to manage your Serverless Containers
function Function as a Service API
jobs This API allows you to manage your Serverless Jobs

STORAGE COMMANDS:
block This API allows you to manage your Block Storage volumes
object Object-storage utils
registry This API allows you to manage your Container Registry resources

UTILITY COMMANDS:
autocomplete Autocomplete related commands
feedback Send feedback to the Scaleway CLI Team!
help Get help about how the CLI works
shell Start shell mode
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/account/v3/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ import (
func GetCommands() *core.Commands {
commands := GetGeneratedCommands()

commands.MustFind("account").Groups = []string{"security"}

return commands
}
2 changes: 2 additions & 0 deletions internal/namespaces/applesilicon/v1alpha1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ func GetCommands() *core.Commands {
serverWaitCommand(),
))

cmds.MustFind("apple-silicon").Groups = []string{"baremetal"}

human.RegisterMarshalerFunc(applesilicon.ServerTypeCPU{}, cpuMarshalerFunc)
human.RegisterMarshalerFunc(applesilicon.ServerTypeDisk{}, diskMarshalerFunc)
human.RegisterMarshalerFunc(applesilicon.ServerTypeMemory{}, memoryMarshalerFunc)
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/audit_trail/v1alpha1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("audit-trail").Groups = []string{"security", "monitoring"}

cmds.MustFind("audit-trail", "event", "list").Override(eventListBuilder)

return cmds
Expand Down
1 change: 1 addition & 0 deletions internal/namespaces/autocomplete/autocomplete.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func autocompleteRootCommand() *core.Command {
Short: `Autocomplete related commands`,
Long: ``,
Namespace: "autocomplete",
Groups: []string{"utility"},
}
}

Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/baremetal/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("baremetal").Groups = []string{"baremetal"}

cmds.Merge(core.NewCommands(
serverWaitCommand(),
serverAddFlexibleIP(),
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/billing/v2beta1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var invoiceTypeMarshalSpecs = human.EnumMarshalSpecs{
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("billing").Groups = []string{"cost"}

human.RegisterMarshalerFunc(billing.DownloadInvoiceRequestFileType("pdf"), human.EnumMarshalFunc(invoiceTypeMarshalSpecs))
cmds.MustFind("billing", "invoice", "download").Override(invoiceDownloadBuilder)
cmds.MustFind("billing", "invoice", "export").Override(invoiceExportBuilder)
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/block/v1alpha1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ var (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("block").Groups = []string{"storage"}

cmds.Add(volumeWaitCommand())
cmds.Add(snapshotWaitCommand())

Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/cockpit/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("cockpit").Groups = []string{"monitoring"}

cmds.MustFind("cockpit", "token", "get").Override(cockpitTokenGetBuilder)

return cmds
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/container/v1beta1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("container").Groups = []string{"serverless"}

human.RegisterMarshalerFunc(container.NamespaceStatus(""), human.EnumMarshalFunc(namespaceStatusMarshalSpecs))
human.RegisterMarshalerFunc(container.ContainerStatus(""), human.EnumMarshalFunc(containerStatusMarshalSpecs))
human.RegisterMarshalerFunc(container.CronStatus(""), human.EnumMarshalFunc(cronStatusMarshalSpecs))
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/dedibox/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("dedibox").Groups = []string{"baremetal"}

for _, commandPath := range [][]string{
{"dedibox", "server", "list"},
{"dedibox", "service", "list"},
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/documentdb/v1beta1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var instanceStatusMarshalSpecs = human.EnumMarshalSpecs{
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("document-db").Groups = []string{"database"}

human.RegisterMarshalerFunc(documentdb.InstanceStatus(""), human.EnumMarshalFunc(instanceStatusMarshalSpecs))

cmds.MustFind("document-db", "engine", "list").Override(engineListBuilder)
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/domain/v2beta1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const defaultTTL = "3600"
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("dns").Groups = []string{"Domain & WebHosting"}

cmds.Merge(core.NewCommands(
dnsRecordAddCommand(),
dnsRecordSetCommand(),
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/edge_services/v1alpha1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ import "github.com/scaleway/scaleway-cli/v2/core"
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("edge-services").Groups = []string{"network"}

return cmds
}
2 changes: 2 additions & 0 deletions internal/namespaces/flexibleip/v1alpha1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("fip").Groups = []string{"baremetal"}

human.RegisterMarshalerFunc(fip.FlexibleIPStatus(""), human.EnumMarshalFunc(ipStatusMarshalSpecs))
human.RegisterMarshalerFunc(fip.MACAddressStatus(""), human.EnumMarshalFunc(macAddressStatusMarshalSpecs))

Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/function/v1beta1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("function").Groups = []string{"serverless"}

human.RegisterMarshalerFunc(function.NamespaceStatus(""), human.EnumMarshalFunc(namespaceStatusMarshalSpecs))
human.RegisterMarshalerFunc(function.FunctionStatus(""), human.EnumMarshalFunc(functionStatusMarshalSpecs))
human.RegisterMarshalerFunc(function.CronStatus(""), human.EnumMarshalFunc(cronStatusMarshalSpecs))
Expand Down
1 change: 1 addition & 0 deletions internal/namespaces/help/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func helpRoot() *core.Command {
Short: "Get help about how the CLI works",
Namespace: "help",
AllowAnonymousClient: true,
Groups: []string{"utility"},
}
}

Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/iam/v1alpha1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var logActionMarshalSpecs = human.EnumMarshalSpecs{
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("iam").Groups = []string{"security"}

human.RegisterMarshalerFunc(iam.LogAction(""), human.EnumMarshalFunc(logActionMarshalSpecs))

cmds.Merge(core.NewCommands(
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/inference/v1beta1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("inference").Groups = []string{"ai"}

human.RegisterMarshalerFunc(inference.DeploymentStatus(""), human.EnumMarshalFunc(deployementStateMarshalSpecs))

human.RegisterMarshalerFunc(inference.Deployment{}, DeploymentMarshalerFunc)
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/instance/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ func GetCommands() *core.Commands {
human.RegisterMarshalerFunc([]*instance.Server{}, serversMarshalerFunc)
human.RegisterMarshalerFunc(instance.Bootscript{}, bootscriptMarshalerFunc)

cmds.MustFind("instance").Groups = []string{"compute"}

cmds.MustFind("instance", "server", "list").Override(serverListBuilder)
cmds.MustFind("instance", "server", "update").Override(serverUpdateBuilder)
cmds.MustFind("instance", "server", "get").Override(serverGetBuilder)
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/interlink/v1beta1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("interlink").Groups = []string{"network"}

human.RegisterMarshalerFunc(interlink.BgpStatus(""), human.EnumMarshalFunc(bgpStatusMarshalSpecs))
human.RegisterMarshalerFunc(interlink.LinkStatus(""), human.EnumMarshalFunc(linkStatusMarshalSpecs))

Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/iot/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("iot").Groups = []string{"integration"}

human.RegisterMarshalerFunc(iot.HubStatus(""), human.EnumMarshalFunc(hubStatusMarshalSpecs))
human.RegisterMarshalerFunc(iot.DeviceMessageFiltersRulePolicy(""), human.EnumMarshalFunc(deviceMessageFiltersRulePolicyMarshalSpecs))
human.RegisterMarshalerFunc(iot.DeviceStatus(""), human.EnumMarshalFunc(deviceStatusMarshalSpecs))
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/ipam/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ import "github.com/scaleway/scaleway-cli/v2/core"
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("ipam").Groups = []string{"network"}

return cmds
}
2 changes: 2 additions & 0 deletions internal/namespaces/jobs/v1alpha1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ var jobRunStateMarshalSpecs = human.EnumMarshalSpecs{
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("jobs").Groups = []string{"serverless"}

human.RegisterMarshalerFunc(jobs.JobRunState(""), human.EnumMarshalFunc(jobRunStateMarshalSpecs))

cmds.Merge(core.NewCommands(
Expand Down
3 changes: 3 additions & 0 deletions internal/namespaces/k8s/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import (
// - Apply handwritten overrides (of Command.Run)
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("k8s").Groups = []string{"container"}

cmds.Merge(core.NewCommands(
k8sExecCredentialCommand(),
k8sKubeconfigCommand(),
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/key_manager/v1alpha1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("keymanager").Groups = []string{"security"}

cmds.MustFind("keymanager", "key", "decrypt").Override(cipherDecrypt)
cmds.MustFind("keymanager", "key", "encrypt").Override(plaintextEncrypt)

Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/lb/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ func GetCommands() *core.Commands {

cmds := GetGeneratedCommands()

cmds.MustFind("lb").Groups = []string{"network"}

cmds.Add(
lbWaitCommand(),
)
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/marketplace/v2/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ func GetCommands() *core.Commands {
// Update commands with custom implementation of fields
updateCommands(marketplaceCommands)

marketplaceCommands.MustFind("marketplace").Groups = []string{"compute"}

return marketplaceCommands
}
2 changes: 2 additions & 0 deletions internal/namespaces/mnq/v1beta1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("mnq").Groups = []string{"integration"}

human.RegisterMarshalerFunc(mnq.SnsInfoStatus(""), human.EnumMarshalFunc(mnqSqsInfoStatusMarshalSpecs))

cmds.MustFind("mnq", "nats", "get-account").Override(mnqNatsGetAccountBuilder)
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/mongodb/v1alpha1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("mongodb").Groups = []string{"database"}

human.RegisterMarshalerFunc(mongodb.SnapshotStatus(""), human.EnumMarshalFunc(snapshotStatusMarshalSpecs))
human.RegisterMarshalerFunc(mongodb.InstanceStatus(""), human.EnumMarshalFunc(instanceStatusMarshalSpecs))
human.RegisterMarshalerFunc(mongodb.NodeTypeStock(""), human.EnumMarshalFunc(nodeTypeStockMarshalSpecs))
Expand Down
1 change: 1 addition & 0 deletions internal/namespaces/object/v1/custom_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ func objectRoot() *core.Command {
return &core.Command{
Short: `Object-storage utils`,
Namespace: "object",
Groups: []string{"storage"},
}
}

Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/rdb/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("rdb").Groups = []string{"database"}

human.RegisterMarshalerFunc(rdb.Instance{}, instanceMarshalerFunc)
human.RegisterMarshalerFunc(rdb.BackupSchedule{}, backupScheduleMarshalerFunc)
human.RegisterMarshalerFunc(backupDownloadResult{}, backupResultMarshallerFunc)
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/redis/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.MustFind("redis").Groups = []string{"database"}

human.RegisterMarshalerFunc(redis.Cluster{}, redisClusterGetMarshalerFunc)

cmds.Merge(core.NewCommands(clusterWaitCommand()))
Expand Down
Loading
Loading