From efaaa22897a069937e3017dbeb01dfeb6a6aec80 Mon Sep 17 00:00:00 2001 From: Chris Kim Date: Tue, 14 Nov 2023 08:23:28 -0800 Subject: [PATCH] add aliases to a few commands (#839) --- cmd/krew/cmd/index.go | 8 +++++--- cmd/krew/cmd/list.go | 1 + cmd/krew/cmd/uninstall.go | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/krew/cmd/index.go b/cmd/krew/cmd/index.go index c3154ba5..9aa04b91 100644 --- a/cmd/krew/cmd/index.go +++ b/cmd/krew/cmd/index.go @@ -48,7 +48,8 @@ var indexListCmd = &cobra.Command{ This command prints a list of indexes. It shows the name and the remote URL for each configured index in table format.`, - Args: cobra.NoArgs, + Aliases: []string{"ls"}, + Args: cobra.NoArgs, RunE: func(_ *cobra.Command, _ []string) error { indexes, err := indexoperations.ListIndexes(paths) if err != nil { @@ -95,8 +96,9 @@ It is only safe to remove indexes without installed plugins. Removing an index while there are plugins installed will result in an error, unless the --force option is used (not recommended).`, - Args: cobra.ExactArgs(1), - RunE: indexDelete, + Aliases: []string{"rm"}, + Args: cobra.ExactArgs(1), + RunE: indexDelete, } func indexDelete(_ *cobra.Command, args []string) error { diff --git a/cmd/krew/cmd/list.go b/cmd/krew/cmd/list.go index 5b538830..b9373e15 100644 --- a/cmd/krew/cmd/list.go +++ b/cmd/krew/cmd/list.go @@ -39,6 +39,7 @@ Remarks: Redirecting the output of this command to a program or file will only print the names of the plugins installed. This output can be piped back to the "install" command.`, + Aliases: []string{"ls"}, RunE: func(cmd *cobra.Command, args []string) error { receipts, err := installation.GetInstalledPluginReceipts(paths.InstallReceiptsPath()) if err != nil { diff --git a/cmd/krew/cmd/uninstall.go b/cmd/krew/cmd/uninstall.go index 97b4aa44..ea5a4101 100644 --- a/cmd/krew/cmd/uninstall.go +++ b/cmd/krew/cmd/uninstall.go @@ -54,7 +54,7 @@ Remarks: }, PreRunE: checkIndex, Args: cobra.MinimumNArgs(1), - Aliases: []string{"remove"}, + Aliases: []string{"remove", "rm"}, } func unsafePluginNameErr(n string) error { return errors.Errorf("plugin name %q not allowed", n) }