diff --git a/command.go b/command.go index 2399912..83b6021 100644 --- a/command.go +++ b/command.go @@ -7,6 +7,7 @@ import ( type Command struct { Name string + Aliases []string Description string Flags map[string]string PersistentFlags map[string]string @@ -22,9 +23,10 @@ type Command struct { func (c *Command) ToCobra() *cobra.Command { cmd := &cobra.Command{ - Use: c.Name, - Short: c.Description, - Run: func(cmd *cobra.Command, args []string) {}, + Use: c.Name, + Aliases: c.Aliases, + Short: c.Description, + Run: func(cmd *cobra.Command, args []string) {}, } carapace.Gen(cmd).Standalone() diff --git a/docs/src/carapace-spec/command.md b/docs/src/carapace-spec/command.md index 9bcbc81..9df711b 100644 --- a/docs/src/carapace-spec/command.md +++ b/docs/src/carapace-spec/command.md @@ -3,6 +3,7 @@ ```go type Command struct { Name string + Aliases []string Description string Flags map[string]string PersistentFlags map[string]string diff --git a/example/example.yaml b/example/example.yaml index 048fa44..57cfc82 100644 --- a/example/example.yaml +++ b/example/example.yaml @@ -4,6 +4,7 @@ persistentflags: -p, --persistent: persistent flag commands: - name: sub1 + aliases: [alias1, alias2] description: subcommand1 flags: -s, --styled=: styled values