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 {
70
70
HelpName string
71
71
// The name used on the CLI by the user
72
72
UserName string
73
-
74
- commandNamePath []string
75
73
}
76
74
77
75
func Hide () bool {
@@ -81,9 +79,6 @@ func Hide() bool {
81
79
// FullName returns the full name of the command.
82
80
// For subcommands this ensures that parent commands are part of the command path
83
81
func (c * Command ) FullName () string {
84
- if c .commandNamePath != nil {
85
- return strings .Join (c .commandNamePath , " " )
86
- }
87
82
if c .Category != "" {
88
83
return strings .Join ([]string {c .Category , c .Name }, ":" )
89
84
}
@@ -164,12 +159,8 @@ func (c *Command) Run(ctx *Context) (err error) {
164
159
165
160
// Names returns the names including short names and aliases.
166
161
func (c * Command ) Names () []string {
167
- name := c .Name
168
- if c .Category != "" {
169
- name = c .Category + ":" + name
170
- }
171
162
names := []string {}
172
- if name != "" {
163
+ if name := c . FullName (); name != "" {
173
164
names = append (names , name )
174
165
}
175
166
for _ , a := range c .Aliases {
Original file line number Diff line number Diff line change @@ -62,11 +62,16 @@ func AutocompleteAppAction(c *Context) error {
62
62
}
63
63
64
64
// transpose registered commands and flags to posener/complete equivalence
65
- for _ , command := range c .App .VisibleCommands () {
65
+ for _ , command := range c .App .Commands {
66
66
subCmd := command .convertToPosenerCompleteCommand (c )
67
67
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
+ }
70
75
}
71
76
}
72
77
You can’t perform that action at this time.
0 commit comments