From 0aaf87065fac479e7d05b2d12ea0061f248c131e Mon Sep 17 00:00:00 2001 From: Johannes Frey Date: Tue, 18 Jun 2024 17:55:58 +0200 Subject: [PATCH] chore: provide space aliases for platform namespace subcommands --- cmd/vclusterctl/cmd/platform/connect/space.go | 9 +++++---- cmd/vclusterctl/cmd/platform/create/space.go | 9 +++++---- cmd/vclusterctl/cmd/platform/delete/space.go | 9 +++++---- cmd/vclusterctl/cmd/platform/list/spaces.go | 9 +++++---- cmd/vclusterctl/cmd/platform/sleep/space.go | 9 +++++---- cmd/vclusterctl/cmd/platform/wakeup/space.go | 9 +++++---- 6 files changed, 30 insertions(+), 24 deletions(-) diff --git a/cmd/vclusterctl/cmd/platform/connect/space.go b/cmd/vclusterctl/cmd/platform/connect/space.go index c3e9fbaae..9da9d0190 100644 --- a/cmd/vclusterctl/cmd/platform/connect/space.go +++ b/cmd/vclusterctl/cmd/platform/connect/space.go @@ -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 { diff --git a/cmd/vclusterctl/cmd/platform/create/space.go b/cmd/vclusterctl/cmd/platform/create/space.go index 733224eda..2d83dcb23 100644 --- a/cmd/vclusterctl/cmd/platform/create/space.go +++ b/cmd/vclusterctl/cmd/platform/create/space.go @@ -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() diff --git a/cmd/vclusterctl/cmd/platform/delete/space.go b/cmd/vclusterctl/cmd/platform/delete/space.go index e65f4196e..a6689f9dd 100644 --- a/cmd/vclusterctl/cmd/platform/delete/space.go +++ b/cmd/vclusterctl/cmd/platform/delete/space.go @@ -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() diff --git a/cmd/vclusterctl/cmd/platform/list/spaces.go b/cmd/vclusterctl/cmd/platform/list/spaces.go index 5c50a7eb1..952df305e 100644 --- a/cmd/vclusterctl/cmd/platform/list/spaces.go +++ b/cmd/vclusterctl/cmd/platform/list/spaces.go @@ -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()) }, diff --git a/cmd/vclusterctl/cmd/platform/sleep/space.go b/cmd/vclusterctl/cmd/platform/sleep/space.go index 4a6ad2c43..6269fb5cb 100644 --- a/cmd/vclusterctl/cmd/platform/sleep/space.go +++ b/cmd/vclusterctl/cmd/platform/sleep/space.go @@ -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) }, diff --git a/cmd/vclusterctl/cmd/platform/wakeup/space.go b/cmd/vclusterctl/cmd/platform/wakeup/space.go index 87dfa9f8e..fb34ef9b7 100644 --- a/cmd/vclusterctl/cmd/platform/wakeup/space.go +++ b/cmd/vclusterctl/cmd/platform/wakeup/space.go @@ -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) },