Skip to content

Commit 803ace3

Browse files
committed
minor zsh completion styling fixes
1 parent ddb70c9 commit 803ace3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

templates/completion.zsh.gotmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ _{{ .CMDVarName }}()
8282
__{{ .CMDVarName }}_debug "completions: ${out}"
8383
__{{ .CMDVarName }}_debug "flagPrefix: ${flagPrefix}"
8484

85-
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
85+
if (((directive & shellCompDirectiveError) != 0)); then
8686
__{{ .CMDVarName }}_debug "Completion received error. Ignoring completions."
8787
return
8888
fi
8989

9090
while IFS='\n' read -r comp; do
91-
if [ -n "$comp" ]; then
91+
if [[ -n $comp ]]; then
9292
# If requested, completions are returned with a description.
9393
# The description is preceded by a TAB character.
9494
# For zsh's _describe, we need to use a : instead of a TAB.
@@ -104,12 +104,12 @@ _{{ .CMDVarName }}()
104104
fi
105105
done < <(printf "%s\n" "${out[@]}")
106106

107-
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
107+
if (((directive & shellCompDirectiveNoSpace) != 0)); then
108108
__{{ .CMDVarName }}_debug "Activating nospace."
109109
noSpace="-S ''"
110110
fi
111111

112-
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
112+
if (((directive & shellCompDirectiveFilterFileExt) != 0)); then
113113
# File extension filtering
114114
local filteringCmd
115115
filteringCmd='_files'
@@ -124,7 +124,7 @@ _{{ .CMDVarName }}()
124124

125125
__{{ .CMDVarName }}_debug "File filtering command: $filteringCmd"
126126
_arguments '*:filename:'"$filteringCmd"
127-
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
127+
elif (((directive & shellCompDirectiveFilterDirs) != 0)); then
128128
# File completion for directories only
129129
local subdir
130130
subdir="${completions[1]}"
@@ -152,7 +152,7 @@ _{{ .CMDVarName }}()
152152
else
153153
__{{ .CMDVarName }}_debug "_describe did not find completions."
154154
__{{ .CMDVarName }}_debug "Checking if we should do file completion."
155-
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
155+
if (((directive & shellCompDirectiveNoFileComp) != 0)); then
156156
__{{ .CMDVarName }}_debug "deactivating file completion"
157157

158158
# We must return an error code here to let zsh know that there were no

0 commit comments

Comments
 (0)