From e132922d23968ff5ae37efbf143df055f5367624 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Fri, 27 Nov 2020 06:40:13 -0500 Subject: [PATCH] Support __completeNoDesc hidden command (#1922) The __completeNoDesc command is used by bash to request completion without any descriptions. It must be properly supported for cobra.Command.ValidArgsFunction to work with bash completion. Signed-off-by: Marc Khouzam --- cmd/root.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index eb326b5d2de..dc1111156eb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -87,8 +87,9 @@ func shouldPrependRelease(cmd *cobra.Command, args []string) bool { return false } - // allow help and __complete commands. - if len(args) > 0 && (args[0] == "help" || args[0] == "__complete") { + // allow help and the two __complete commands. + if len(args) > 0 && (args[0] == "help" || + args[0] == cobra.ShellCompRequestCmd || args[0] == cobra.ShellCompNoDescRequestCmd) { return false }