Skip to content

Commit 5b69e81

Browse files
feat: Add consistent aliases (#362)
1 parent 8bc5297 commit 5b69e81

File tree

36 files changed

+431
-33
lines changed

36 files changed

+431
-33
lines changed

internal/commands/account/account.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ func BaseAccountCommand() commands.Command {
1212
type accountCommand struct {
1313
*commands.BaseCommand
1414
}
15+
16+
// InitCommand implements Command.InitCommand
17+
func (acc *accountCommand) InitCommand() {
18+
acc.Cobra().Aliases = []string{"acc"}
19+
}

internal/commands/gateway/gateway.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ func BaseGatewayCommand() commands.Command {
1414
type gatewayCommand struct {
1515
*commands.BaseCommand
1616
}
17+
18+
// InitCommand implements Command.InitCommand
19+
func (gw *gatewayCommand) InitCommand() {
20+
gw.Cobra().Aliases = []string{"gw"}
21+
}

internal/commands/kubernetes/config.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,18 @@ func (c *configCommand) InitCommand() {
4646
"",
4747
"Absolute path for writing output. If the file exists, the config will be merged.")
4848
c.AddFlags(flagSet)
49+
50+
// Deprecating k8s
51+
// TODO: Remove this in the future
52+
commands.SetSubcommandDeprecationHelp(c, []string{"k8s"})
4953
}
5054

5155
// Execute implements commands.MultipleArgumentCommand
5256
func (c *configCommand) Execute(exec commands.Executor, uuid string) (output.Output, error) {
57+
// Deprecating k8s
58+
// TODO: Remove this in the future
59+
commands.SetSubcommandExecutionDeprecationMessage(c, []string{"k8s"}, "uks")
60+
5361
svc := exec.All()
5462

5563
msg := fmt.Sprintf("Getting kubeconfig for Kubernetes cluster %s", uuid)

internal/commands/kubernetes/create.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ func (c *createCommand) InitCommand() {
152152
commands.Must(c.Cobra().MarkFlagRequired("network"))
153153
commands.Must(c.Cobra().MarkFlagRequired("zone"))
154154
commands.Must(c.Cobra().RegisterFlagCompletionFunc("name", cobra.NoFileCompletions))
155+
156+
// Deprecating k8s
157+
// TODO: Remove this in the future
158+
commands.SetSubcommandDeprecationHelp(c, []string{"k8s"})
155159
}
156160

157161
func (c *createCommand) InitCommandWithConfig(cfg *config.Config) {
@@ -162,6 +166,10 @@ func (c *createCommand) InitCommandWithConfig(cfg *config.Config) {
162166

163167
// ExecuteWithoutArguments implements commands.NoArgumentCommand
164168
func (c *createCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Output, error) {
169+
// Deprecating k8s
170+
// TODO: Remove this in the future
171+
commands.SetSubcommandExecutionDeprecationMessage(c, []string{"k8s"}, "uks")
172+
165173
svc := exec.All()
166174

167175
if err := c.params.processParams(exec); err != nil {

internal/commands/kubernetes/delete.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,19 @@ type deleteCommand struct {
2929
completion.Kubernetes
3030
}
3131

32+
// InitCommand implements Command.InitCommand
33+
func (s *deleteCommand) InitCommand() {
34+
// Deprecating k8s
35+
// TODO: Remove this in the future
36+
commands.SetSubcommandDeprecationHelp(s, []string{"k8s"})
37+
}
38+
3239
// Execute implements commands.MultipleArgumentCommand
3340
func (s *deleteCommand) Execute(exec commands.Executor, arg string) (output.Output, error) {
41+
// Deprecating k8s
42+
// TODO: Remove this in the future
43+
commands.SetSubcommandExecutionDeprecationMessage(s, []string{"k8s"}, "uks")
44+
3445
svc := exec.All()
3546
msg := fmt.Sprintf("Deleting Kubernetes cluster %v", arg)
3647
exec.PushProgressStarted(msg)

internal/commands/kubernetes/kubernetes.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ type kubernetesCommand struct {
1818
// InitCommand implements Command.InitCommand
1919
func (k *kubernetesCommand) InitCommand() {
2020
k.Cobra().Aliases = []string{"k8s", "uks"}
21+
// Deprecating k8s
22+
// TODO: Remove this in the future
23+
commands.SetDeprecationHelp(k.Cobra(), []string{"k8s"})
2124
}

internal/commands/kubernetes/list.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,19 @@ type listCommand struct {
2020
*commands.BaseCommand
2121
}
2222

23+
// InitCommand implements Command.InitCommand
24+
func (s *listCommand) InitCommand() {
25+
// Deprecating k8s
26+
// TODO: Remove this in the future
27+
commands.SetSubcommandDeprecationHelp(s, []string{"k8s"})
28+
}
29+
2330
// ExecuteWithoutArguments implements commands.NoArgumentCommand
2431
func (s *listCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Output, error) {
32+
// Deprecating k8s
33+
// TODO: Remove this in the future
34+
commands.SetSubcommandExecutionDeprecationMessage(s, []string{"k8s"}, "uks")
35+
2536
svc := exec.All()
2637
clusters, err := svc.GetKubernetesClusters(exec.Context(), &request.GetKubernetesClustersRequest{})
2738
if err != nil {

internal/commands/kubernetes/modify.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,18 @@ func (c *modifyCommand) InitCommand() {
5252
c.AddFlags(fs)
5353
c.Cobra().MarkFlagsMutuallyExclusive("label", "clear-labels")
5454
commands.Must(c.Cobra().RegisterFlagCompletionFunc("label", cobra.NoFileCompletions))
55+
56+
// Deprecating k8s
57+
// TODO: Remove this in the future
58+
commands.SetSubcommandDeprecationHelp(c, []string{"k8s"})
5559
}
5660

5761
// Execute implements commands.MultipleArgumentCommand
5862
func (c *modifyCommand) Execute(exec commands.Executor, arg string) (output.Output, error) {
63+
// Deprecating k8s
64+
// TODO: Remove this in the future
65+
commands.SetSubcommandExecutionDeprecationMessage(c, []string{"k8s"}, "uks")
66+
5967
msg := fmt.Sprintf("Modifying Kubernetes cluster %v", arg)
6068
exec.PushProgressStarted(msg)
6169

internal/commands/kubernetes/plans.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,19 @@ type plansCommand struct {
1717
*commands.BaseCommand
1818
}
1919

20+
// InitCommand implements Command.InitCommand
21+
func (s *plansCommand) InitCommand() {
22+
// Deprecating k8s
23+
// TODO: Remove this in the future
24+
commands.SetSubcommandDeprecationHelp(s, []string{"k8s"})
25+
}
26+
2027
// Execute implements commands.NoArgumentCommand
2128
func (s *plansCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Output, error) {
29+
// Deprecating k8s
30+
// TODO: Remove this in the future
31+
commands.SetSubcommandExecutionDeprecationMessage(s, []string{"k8s"}, "uks")
32+
2233
svc := exec.All()
2334
plans, err := svc.GetKubernetesPlans(exec.Context(), &request.GetKubernetesPlansRequest{})
2435
if err != nil {

internal/commands/kubernetes/show.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,19 @@ type showCommand struct {
3434
completion.Kubernetes
3535
}
3636

37+
// InitCommand implements Command.InitCommand
38+
func (s *showCommand) InitCommand() {
39+
// Deprecating k8s
40+
// TODO: Remove this in the future
41+
commands.SetSubcommandDeprecationHelp(s, []string{"k8s"})
42+
}
43+
3744
// Execute implements commands.MultipleArgumentCommand
3845
func (s *showCommand) Execute(exec commands.Executor, uuid string) (output.Output, error) {
46+
// Deprecating k8s
47+
// TODO: Remove this in the future
48+
commands.SetSubcommandExecutionDeprecationMessage(s, []string{"k8s"}, "uks")
49+
3950
svc := exec.All()
4051
cluster, err := svc.GetKubernetesCluster(exec.Context(), &request.GetKubernetesClusterRequest{UUID: uuid})
4152
if err != nil {

0 commit comments

Comments
 (0)