Skip to content

Commit 8feb13c

Browse files
authored
Merge pull request #1761 from dgageot/fix-completion-command
Fix completion command
2 parents bbded75 + cd4ab29 commit 8feb13c

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

cmd/root/root.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,8 @@ We collect anonymous usage data to help improve cagent. To disable:
178178
Vendor: "Docker Inc.",
179179
Version: version.Version,
180180
})
181-
} else {
182-
if err := rootCmd.ExecuteContext(ctx); err != nil {
183-
return processErr(ctx, err, stderr, rootCmd)
184-
}
181+
} else if err := rootCmd.ExecuteContext(ctx); err != nil {
182+
return processErr(ctx, err, stderr, rootCmd)
185183
}
186184

187185
return nil
@@ -212,7 +210,7 @@ func defaultToRun(rootCmd *cobra.Command, args []string) []string {
212210

213211
// isSubcommand reports whether name matches a registered subcommand or alias.
214212
func isSubcommand(cmd *cobra.Command, name string) bool {
215-
if name == "help" {
213+
if name == "help" || name == "completion" {
216214
return true
217215
}
218216
for _, sub := range cmd.Commands() {

0 commit comments

Comments
 (0)