Skip to content

Commit 0a34ad1

Browse files
committed
bring to compliance: invoke.completion
1 parent 221895a commit 0a34ad1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

completion/available/invoke.completion.bash

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# shellcheck shell=bash
12
# Invoke (pyinvoke.org) tab-completion script to be sourced with Bash shell.
23

34
# Copyright (c) 2020 Jeff Forcier.
@@ -26,13 +27,13 @@
2627
# https://github.com/pyinvoke/invoke/blob/master/completion/bash
2728

2829
_complete_invoke() {
29-
local candidates
30+
local candidates line
3031

3132
# COMP_WORDS contains the entire command string up til now (including
3233
# program name).
3334
# We hand it to Invoke so it can figure out the current context: spit back
3435
# core options, task names, the current task's options, or some combo.
35-
candidates=$(invoke --complete -- ${COMP_WORDS[*]})
36+
candidates=$(invoke --complete -- "${COMP_WORDS[@]}")
3637

3738
# `compgen -W` takes list of valid options & a partial word & spits back
3839
# possible matches. Necessary for any partial word completions (vs
@@ -43,7 +44,7 @@ _complete_invoke() {
4344
# our candidate list which actually matches.
4445
#
4546
# COMPREPLY is the list of valid completions handed back to `complete`.
46-
COMPREPLY=($(compgen -W "${candidates}" -- $2))
47+
while IFS='' read -r line; do COMPREPLY+=("$line"); done < <(compgen -W "${candidates}" -- "$2")
4748
}
4849

4950
# Tell shell builtin to use the above for completing 'inv'/'invoke':

0 commit comments

Comments
 (0)