Skip to content
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
4 changes: 2 additions & 2 deletions cmd/scw/testdata/test-all-usage-vpc-vpc-usage.golden
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
A Virtual Private Cloud (VPC) allows you to group your regional
Private Networks together. Note that a Private Network can be a
A Virtual Private Cloud (VPC) allows you to group your regional
Private Networks together. Note that a Private Network can be a
part of only one VPC.

USAGE:
Expand Down
4 changes: 2 additions & 2 deletions docs/commands/vpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ scw vpc subnet

## VPC management command

A Virtual Private Cloud (VPC) allows you to group your regional
Private Networks together. Note that a Private Network can be a
A Virtual Private Cloud (VPC) allows you to group your regional
Private Networks together. Note that a Private Network can be a
part of only one VPC.


Expand Down
8 changes: 8 additions & 0 deletions internal/core/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ func (c *Commands) Remove(namespace, verb string) {
}
}

func (c *Commands) RemoveResource(namespace, resource string) {
for i := range c.commands {
if c.commands[i].Namespace == namespace && c.commands[i].Resource == resource && c.commands[i].Verb == "" {
c.commands = append(c.commands[:i], c.commands[i+1:]...)
return
}
}
}
func (c *Commands) Add(cmd *Command) {
c.commands = append(c.commands, cmd)
c.commandIndex[cmd.getPath()] = cmd
Expand Down
1 change: 1 addition & 0 deletions internal/namespaces/vpc/v2/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.Remove("vpc", "post")
cmds.RemoveResource("vpc", "route")
cmds.MustFind("vpc", "private-network", "get").Override(privateNetworkGetBuilder)
human.RegisterMarshalerFunc(vpc.PrivateNetwork{}, privateNetworkMarshalerFunc)

Expand Down
14 changes: 12 additions & 2 deletions internal/namespaces/vpc/v2/vpc_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func GetGeneratedCommands() *core.Commands {
vpcVpc(),
vpcPrivateNetwork(),
vpcSubnet(),
vpcRoute(),
vpcRoutes(),
vpcVpcList(),
vpcVpcCreate(),
Expand Down Expand Up @@ -50,8 +51,8 @@ func vpcRoot() *core.Command {
func vpcVpc() *core.Command {
return &core.Command{
Short: `VPC management command`,
Long: `A Virtual Private Cloud (VPC) allows you to group your regional
Private Networks together. Note that a Private Network can be a
Long: `A Virtual Private Cloud (VPC) allows you to group your regional
Private Networks together. Note that a Private Network can be a
part of only one VPC.`,
Namespace: "vpc",
Resource: "vpc",
Expand Down Expand Up @@ -79,6 +80,15 @@ func vpcSubnet() *core.Command {
}
}

func vpcRoute() *core.Command {
return &core.Command{
Short: `Route management command`,
Long: `Custom routes.`,
Namespace: "vpc",
Resource: "route",
}
}

func vpcRoutes() *core.Command {
return &core.Command{
Short: `Routes management command`,
Expand Down
Loading