From 0ca9047b783d661c455c43e97fbac0d18d5811f0 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 23 Feb 2017 04:39:06 +0100 Subject: tools: fix bash completion spaces --- src/tools/completion/wg.bash-completion | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/tools/completion/wg.bash-completion') diff --git a/src/tools/completion/wg.bash-completion b/src/tools/completion/wg.bash-completion index 1a2e059..355012c 100644 --- a/src/tools/completion/wg.bash-completion +++ b/src/tools/completion/wg.bash-completion @@ -1,6 +1,8 @@ # Copyright (C) 2017 Jason A. Donenfeld . All Rights Reserved. _wg_completion() { + local a + if [[ $COMP_CWORD -eq 1 ]]; then COMPREPLY+=( $(compgen -W "show showconf set setconf addconf genkey genpsk pubkey" -- "${COMP_WORDS[1]}") ) return @@ -25,7 +27,8 @@ _wg_completion() { if [[ $COMP_CWORD -eq 3 && ( ${COMP_WORDS[1]} == setconf || ${COMP_WORDS[1]} == addconf ) ]]; then compopt -o filenames - COMPREPLY+=( $(compgen -f -- "${COMP_WORDS[3]}") ) + mapfile -t a < <(compgen -f -- "${COMP_WORDS[3]}") + COMPREPLY+=( "${a[@]}" ) return fi @@ -49,7 +52,8 @@ _wg_completion() { COMPREPLY+=( $(compgen -W "${words[*]}" -- "${COMP_WORDS[COMP_CWORD]}") ) elif [[ ${COMP_WORDS[COMP_CWORD-1]} == *-key ]]; then compopt -o filenames - COMPREPLY+=( $(compgen -f -- "${COMP_WORDS[COMP_CWORD]}") ) + mapfile -t a < <(compgen -f -- "${COMP_WORDS[COMP_CWORD]}") + COMPREPLY+=( "${a[@]}" ) fi return fi -- cgit v1.2.3-59-g8ed1b