Skip to content

Commit e32c9ce

Browse files
committed
completions-getter: Rename returned COMPLETE_ACTION to COMPLETE_CALL
That's what it actually is and remove confusion with actual actions
1 parent 4a5c1b8 commit e32c9ce

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

bash-completions-getter.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,25 @@ parse_quoted_arguments() {
9494
}
9595

9696
parse_complete_options() {
97-
unset COMPLETE_ACTION
98-
unset COMPLETE_ACTION_TYPE
97+
unset COMPLETE_CALL
98+
unset COMPLETE_CALL_TYPE
9999
unset COMPLETE_SUPPORTED_COMMANDS
100100
unset COMPLETE_OPTION
101101
unset COMPLETE_WORDS
102102

103-
COMPLETE_ACTION=
103+
COMPLETE_CALL=
104104
COMPLETE_SUPPORTED_COMMANDS=()
105105
COMPLETE_WORDS=()
106106
COMPLETE_OPTION=
107107

108108
while [ ${#@} -gt 0 ]; do
109109
case "$1" in
110110
-F|-C)
111-
[ -n "$COMPLETE_ACTION" ] &&
111+
[ -n "$COMPLETE_CALL" ] &&
112112
return 2
113113

114-
COMPLETE_ACTION="${2}"
115-
COMPLETE_ACTION_TYPE=${1#-}
114+
COMPLETE_CALL="${2}"
115+
COMPLETE_CALL_TYPE=${1#-}
116116
shift 2
117117
;;
118118
-pr|-D|-E|-A|-G|-F|-C|-P|-S)
@@ -140,7 +140,7 @@ parse_complete_options() {
140140
esac
141141
done
142142

143-
[ -z "$COMPLETE_ACTION" ] && [ ${#COMPLETE_WORDS[@]} -eq 0 ] \
143+
[ -z "$COMPLETE_CALL" ] && [ ${#COMPLETE_WORDS[@]} -eq 0 ] \
144144
&& return;
145145

146146
while [ ${#@} -gt 0 ]; do
@@ -202,7 +202,7 @@ get_completions() {
202202
parse_quoted_arguments "$args" "'"
203203
parse_complete_options "${UNQUOTED_ARGS[@]}"
204204

205-
completion="$COMPLETE_ACTION"
205+
completion="$COMPLETE_CALL"
206206
_COMP_OPTIONS+=("$COMPLETE_OPTION")
207207
else
208208
return 1;
@@ -225,7 +225,7 @@ get_completions() {
225225
fi
226226

227227
if [ -n "$ZSH_BASH_COMPLETION_COMPLETION_FALLBACK_DEBUG" ]; then
228-
echo "Completion action is '$completion' of type '$COMPLETE_ACTION_TYPE'" >&2
228+
echo "Completion action is '$completion' of type '$COMPLETE_CALL_TYPE'" >&2
229229
fi
230230

231231
# execute completion function or command (exporting the needed variables)
@@ -247,7 +247,7 @@ get_completions() {
247247
echo -n "Calling " >&2; printf "'%s'," "${cmd[@]}" >&2; echo >&2
248248
fi
249249

250-
if [ "$COMPLETE_ACTION_TYPE" == 'C' ]; then
250+
if [ "$COMPLETE_CALL_TYPE" == 'C' ]; then
251251
export COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS COMP_WORDBREAKS
252252
mapfile -t COMPREPLY < <("${cmd[@]}" 2>"$errorout")
253253
else

0 commit comments

Comments
 (0)