Skip to content

Commit

Permalink
Merge pull request #1877 from johannesfrey/space-alias-for-namespace
Browse files Browse the repository at this point in the history
chore: provide space aliases for platform namespace subcommands
  • Loading branch information
FabianKramm authored Jun 18, 2024
2 parents 882c8e0 + 0aaf870 commit d8064c8
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 24 deletions.
9 changes: 5 additions & 4 deletions cmd/vclusterctl/cmd/platform/connect/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ vcluster platform connect namespace myspace --project myproject
`)
useLine, validator := util.NamedPositionalArgsValidator(false, false, "SPACE_NAME")
c := &cobra.Command{
Use: "namespace" + useLine,
Short: "Creates a kube context for the given vCluster platform namespace",
Long: description,
Args: validator,
Use: "namespace" + useLine,
Short: "Creates a kube context for the given vCluster platform namespace",
Long: description,
Args: validator,
Aliases: []string{"space"},
RunE: func(cobraCmd *cobra.Command, args []string) error {
// Check for newer version
if !cmd.Print {
Expand Down
9 changes: 5 additions & 4 deletions cmd/vclusterctl/cmd/platform/create/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ vcluster platform create namespace myspace --project myproject --team myteam
########################################################
`)
c := &cobra.Command{
Use: "namespace" + util.NamespaceNameOnlyUseLine,
Short: "Creates a new vCluster platform namespace in the given cluster",
Long: description,
Args: util.NamespaceNameOnlyValidator,
Use: "namespace" + util.NamespaceNameOnlyUseLine,
Short: "Creates a new vCluster platform namespace in the given cluster",
Long: description,
Args: util.NamespaceNameOnlyValidator,
Aliases: []string{"space"},
RunE: func(cobraCmd *cobra.Command, args []string) error {
// Check for newer version
upgrade.PrintNewerVersionWarning()
Expand Down
9 changes: 5 additions & 4 deletions cmd/vclusterctl/cmd/platform/delete/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ vcluster platform delete namespace myspace --project myproject
########################################################
`)
c := &cobra.Command{
Use: "namespace" + util.NamespaceNameOnlyUseLine,
Short: "Deletes a vCluster platform namespace from a cluster",
Long: description,
Args: util.NamespaceNameOnlyValidator,
Use: "namespace" + util.NamespaceNameOnlyUseLine,
Short: "Deletes a vCluster platform namespace from a cluster",
Long: description,
Args: util.NamespaceNameOnlyValidator,
Aliases: []string{"space"},
RunE: func(cobraCmd *cobra.Command, args []string) error {
// Check for newer version
upgrade.PrintNewerVersionWarning()
Expand Down
9 changes: 5 additions & 4 deletions cmd/vclusterctl/cmd/platform/list/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ vcluster platform list namespaces
########################################################
`)
listCmd := &cobra.Command{
Use: "namespaces",
Short: product.Replace("Lists the vCluster platform namespaces you have access to"),
Long: description,
Args: cobra.NoArgs,
Use: "namespaces",
Short: product.Replace("Lists the vCluster platform namespaces you have access to"),
Long: description,
Args: cobra.NoArgs,
Aliases: []string{"spaces"},
RunE: func(cobraCmd *cobra.Command, _ []string) error {
return cmd.RunSpaces(cobraCmd.Context())
},
Expand Down
9 changes: 5 additions & 4 deletions cmd/vclusterctl/cmd/platform/sleep/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ vcluster platform sleep namespace myspace --project myproject
#######################################################
`)
c := &cobra.Command{
Use: "namespace" + util.NamespaceNameOnlyUseLine,
Short: "Put a vCluster platform namespace to sleep",
Long: description,
Args: util.NamespaceNameOnlyValidator,
Use: "namespace" + util.NamespaceNameOnlyUseLine,
Short: "Put a vCluster platform namespace to sleep",
Long: description,
Args: util.NamespaceNameOnlyValidator,
Aliases: []string{"space"},
RunE: func(cobraCmd *cobra.Command, args []string) error {
return cmd.Run(cobraCmd.Context(), args)
},
Expand Down
9 changes: 5 additions & 4 deletions cmd/vclusterctl/cmd/platform/wakeup/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ vcluster platform wakeup namespace myspace --project myproject
#######################################################
`)
c := &cobra.Command{
Use: "namespace" + util.NamespaceNameOnlyUseLine,
Short: "Wakes up a vCluster platform namespace",
Long: description,
Args: util.NamespaceNameOnlyValidator,
Use: "namespace" + util.NamespaceNameOnlyUseLine,
Short: "Wakes up a vCluster platform namespace",
Long: description,
Args: util.NamespaceNameOnlyValidator,
Aliases: []string{"space"},
RunE: func(cobraCmd *cobra.Command, args []string) error {
return cmd.Run(cobraCmd.Context(), args)
},
Expand Down

0 comments on commit d8064c8

Please sign in to comment.