Skip to content

Commit

Permalink
Fix shellcheck issues for completion
Browse files Browse the repository at this point in the history
  • Loading branch information
yankeexe committed Jan 23, 2022
1 parent 088efb0 commit ab52fe6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion completions/_wt_completion
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare -A opts
setopt shwordsplit
for item in $list
do
base="$(basename ${item} | xargs)"
base="$(basename -- "$item")"
opts+=(["$base"]="$base")
done
unsetopt shwordsplit
Expand Down
5 changes: 3 additions & 2 deletions completions/wt_completion
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ _wt() {

for item in $list
do
opts+="$(basename "$item") "
opts+="$(basename -- "$item") "
done

# Only show suggestions for the root command (wt)
# Pass autocompletion suggestion as "words (-W)" to `compgen` separated by space
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "${opts}" -- "$cur") )
# shellcheck disable=SC2207
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
fi
}

Expand Down

0 comments on commit ab52fe6

Please sign in to comment.