Skip to content

Commit

Permalink
Fix handling of descriptions for bash v3
Browse files Browse the repository at this point in the history
Fixes #1734

Tab characters that introduce completion descriptions weren't properly
being handled with bash v3.  This change fixes that.

Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>

Merge spf13/cobra#1735
  • Loading branch information
marckhouzam authored and hoshsadiq committed Aug 24, 2022
1 parent c3e6b4f commit 6908720
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion resources/bash_completion.sh.gotmpl
Expand Up @@ -156,7 +156,7 @@ __{{ .CMDVarName }}_handle_standard_completion_case() {
local tab=$'\t' comp

# Short circuit to optimize if we don't have descriptions
if [[ $out != *$tab* ]]; then
if [[ "$out" != *$tab* ]]; then
IFS=$'\n' read -ra COMPREPLY -d '' < <(IFS=$'\n' compgen -W "$out" -- "$cur")
return 0
fi
Expand Down

0 comments on commit 6908720

Please sign in to comment.