From b11e9425dc07708bc36b54fc318d9b421a1887c6 Mon Sep 17 00:00:00 2001 From: bart Date: Sun, 26 May 2024 17:43:11 +0300 Subject: [PATCH] Support command shorthands fixes #372 --- internal/cmd/context.go | 7 +++++-- internal/commands/permission.go | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/cmd/context.go b/internal/cmd/context.go index d49757b2..1f34e43d 100644 --- a/internal/cmd/context.go +++ b/internal/cmd/context.go @@ -26,13 +26,15 @@ func registerContextCmd(rootCmd *cobra.Command) { } var contextCmd = &cobra.Command{ - Use: "context ", - Short: "Manage configurations for connecting to SpiceDB deployments", + Use: "context ", + Short: "Manage configurations for connecting to SpiceDB deployments", + Aliases: []string{"ctx"}, } var contextListCmd = &cobra.Command{ Use: "list", Short: "Lists all available contexts", + Aliases: []string{"ls"}, Args: cobra.ExactArgs(0), ValidArgsFunction: cobra.NoFileCompletions, RunE: contextListCmdFunc, @@ -49,6 +51,7 @@ var contextSetCmd = &cobra.Command{ var contextRemoveCmd = &cobra.Command{ Use: "remove ", Short: "Removes a context", + Aliases: []string{"rm"}, Args: cobra.ExactArgs(1), ValidArgsFunction: ContextGet, RunE: contextRemoveCmdFunc, diff --git a/internal/commands/permission.go b/internal/commands/permission.go index c58283ff..bf424527 100644 --- a/internal/commands/permission.go +++ b/internal/commands/permission.go @@ -112,8 +112,9 @@ func RegisterPermissionCmd(rootCmd *cobra.Command) *cobra.Command { } var permissionCmd = &cobra.Command{ - Use: "permission ", - Short: "Query the permissions in a permissions system", + Use: "permission ", + Short: "Query the permissions in a permissions system", + Aliases: []string{"perm"}, } var checkBulkCmd = &cobra.Command{