1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-11 14:39:28 +02:00

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 <marc.khouzam@gmail.com>
This commit is contained in:
Marc Khouzam 2020-11-27 06:40:13 -05:00 committed by GitHub
parent c011943613
commit e132922d23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}