From 396a6d7df5a034ea39b7a1917c7a5f68b9d00a2b Mon Sep 17 00:00:00 2001 From: Ville Skyttä Date: Sat, 15 Nov 2014 22:36:04 +0200 Subject: bash-completion: Invoke actual commands to be completed, not basenames Addresses partially: http://bugs.debian.org/769462 Signed-off-by: Ville Skyttä --- bash-completion/chsh | 2 +- bash-completion/eject | 2 +- bash-completion/findmnt | 8 ++++---- bash-completion/losetup | 4 ++-- bash-completion/lsblk | 2 +- bash-completion/setarch | 2 +- bash-completion/setpriv | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'bash-completion') diff --git a/bash-completion/chsh b/bash-completion/chsh index 70641947c..fbf8add88 100644 --- a/bash-completion/chsh +++ b/bash-completion/chsh @@ -6,7 +6,7 @@ _chsh_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-s'|'--shell') - COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) ) + COMPREPLY=( $(compgen -W "$($1 -l)" -- $cur) ) return 0 ;; '-u'|'--help'|'-v'|'--version') diff --git a/bash-completion/eject b/bash-completion/eject index bb7187f04..123829ea2 100644 --- a/bash-completion/eject +++ b/bash-completion/eject @@ -15,7 +15,7 @@ _eject_module() return 0 ;; '-x'|'--cdspeed') - COMPREPLY=( $(compgen -W "$(eject -X)" -- $cur) ) + COMPREPLY=( $(compgen -W "$($1 -X)" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') diff --git a/bash-completion/findmnt b/bash-completion/findmnt index a7df4a0ed..cf66565c1 100644 --- a/bash-completion/findmnt +++ b/bash-completion/findmnt @@ -38,7 +38,7 @@ _findmnt_module() for I in ${TMP_ARR[@]}; do MNT_OPTS[$I]='1' done - done < <(findmnt -rno OPTIONS) + done < <($1 -rno OPTIONS) COMPREPLY=( $(compgen -W "${!MNT_OPTS[@]}" -- $cur) ) return 0 ;; @@ -67,13 +67,13 @@ _findmnt_module() ;; '-S'|'--source') local DEV_MPOINT - DEV_MPOINT=$(findmnt -rno SOURCE | grep ^/dev) + DEV_MPOINT=$($1 -rno SOURCE | grep ^/dev) COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) return 0 ;; '-T'|'--target') local DEV_MPOINT - DEV_MPOINT=$(findmnt -rno TARGET) + DEV_MPOINT=$($1 -rno TARGET) COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) return 0 ;; @@ -117,7 +117,7 @@ _findmnt_module() ;; esac local DEV_MPOINT - DEV_MPOINT=$(findmnt -rno TARGET,SOURCE) + DEV_MPOINT=$($1 -rno TARGET,SOURCE) COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) return 0 } diff --git a/bash-completion/losetup b/bash-completion/losetup index 874c549ae..d2b74184f 100644 --- a/bash-completion/losetup +++ b/bash-completion/losetup @@ -6,12 +6,12 @@ _losetup_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-d'|'--detach') - ARG="$(losetup --output NAME | awk '{if (1 < NR) {print}}')" + ARG="$($1 --output NAME | awk '{if (1 < NR) {print}}')" COMPREPLY=( $(compgen -W "$ARG" -- $cur) ) return 0 ;; '-j'|'--associated') - ARG="$(losetup --output BACK-FILE | awk '{if (1 < NR) {print}}')" + ARG="$($1 --output BACK-FILE | awk '{if (1 < NR) {print}}')" COMPREPLY=( $(compgen -W "$ARG" -- $cur) ) return 0 ;; diff --git a/bash-completion/lsblk b/bash-completion/lsblk index b5dcb400c..af8b9ad65 100644 --- a/bash-completion/lsblk +++ b/bash-completion/lsblk @@ -70,7 +70,7 @@ _lsblk_module() ;; esac local DEVS - COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + COMPREPLY=( $(compgen -W "$($1 -pnro name)" -- $cur) ) return 0 } complete -F _lsblk_module lsblk diff --git a/bash-completion/setarch b/bash-completion/setarch index b2c6a074b..771de98d8 100644 --- a/bash-completion/setarch +++ b/bash-completion/setarch @@ -10,7 +10,7 @@ _setarch_module() ;; esac if [ $COMP_CWORD -eq 1 ]; then - COMPREPLY=( $(compgen -W "$(setarch --list)" -- $cur) ) + COMPREPLY=( $(compgen -W "$($1 --list)" -- $cur) ) return 0 fi case $cur in diff --git a/bash-completion/setpriv b/bash-completion/setpriv index 3be5ccd70..7c21deefa 100644 --- a/bash-completion/setpriv +++ b/bash-completion/setpriv @@ -8,7 +8,7 @@ _setpriv_module() '--inh-caps'|'--bounding-set') # FIXME: how to append to a string with compgen? local INHERIT - INHERIT=$(setpriv --list-caps| awk '{print $1, "-" $1}') + INHERIT=$($1 --list-caps| awk '{print $1, "-" $1}') compopt -o nospace COMPREPLY=( $(compgen -W "all $INHERIT" -S ',' -- $cur) ) return 0 -- cgit v1.2.3-55-g7522