File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -70,8 +70,6 @@ type Command struct {
7070 HelpName string
7171 // The name used on the CLI by the user
7272 UserName string
73-
74- commandNamePath []string
7573}
7674
7775func Hide () bool {
@@ -81,9 +79,6 @@ func Hide() bool {
8179// FullName returns the full name of the command.
8280// For subcommands this ensures that parent commands are part of the command path
8381func (c * Command ) FullName () string {
84- if c .commandNamePath != nil {
85- return strings .Join (c .commandNamePath , " " )
86- }
8782 if c .Category != "" {
8883 return strings .Join ([]string {c .Category , c .Name }, ":" )
8984 }
@@ -164,12 +159,8 @@ func (c *Command) Run(ctx *Context) (err error) {
164159
165160// Names returns the names including short names and aliases.
166161func (c * Command ) Names () []string {
167- name := c .Name
168- if c .Category != "" {
169- name = c .Category + ":" + name
170- }
171162 names := []string {}
172- if name != "" {
163+ if name := c . FullName (); name != "" {
173164 names = append (names , name )
174165 }
175166 for _ , a := range c .Aliases {
Original file line number Diff line number Diff line change @@ -62,11 +62,16 @@ func AutocompleteAppAction(c *Context) error {
6262 }
6363
6464 // transpose registered commands and flags to posener/complete equivalence
65- for _ , command := range c .App .VisibleCommands () {
65+ for _ , command := range c .App .Commands {
6666 subCmd := command .convertToPosenerCompleteCommand (c )
6767
68- for _ , name := range command .Names () {
69- cmd .Sub [name ] = subCmd
68+ if command .Hidden == nil || ! command .Hidden () {
69+ cmd .Sub [command .FullName ()] = subCmd
70+ }
71+ for _ , alias := range command .Aliases {
72+ if ! alias .Hidden {
73+ cmd .Sub [alias .String ()] = subCmd
74+ }
7075 }
7176 }
7277
You can’t perform that action at this time.
0 commit comments