diff options
Diffstat (limited to 'bash-completion/swapoff')
-rw-r--r-- | bash-completion/swapoff | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/bash-completion/swapoff b/bash-completion/swapoff index 60d85724c..40dcf0569 100644 --- a/bash-completion/swapoff +++ b/bash-completion/swapoff @@ -9,25 +9,11 @@ _swapoff_module() return 0 ;; '-U'|'UUID=') - # only works for block devices, i.e., not for swap files. - local SWAPS - SWAPS="$(swapon --show=TYPE,NAME --raw --noheading | \ - awk '$1 !~ /file/ { print $2 }')" - [ -z "$SWAPS" ] && return 0 - local UUIDS - UUIDS="$(lsblk -nrp -o UUID "$SWAPS")" - COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) ) + COMPREPLY=( $(compgen -W "$(swapon --show=UUID --noheading)" -- $cur) ) return 0 ;; '-L'|'LABEL=') - # only works for block devices, i.e., not for swap files. - local SWAPS - SWAPS="$(swapon --show=TYPE,NAME --raw --noheading | \ - awk '$1 !~ /file/ { print $2 }')" - [ -z "$SWAPS" ] && return 0 - local LABELS - LABELS="$(lsblk -nrp -o LABEL "$SWAPS")" - COMPREPLY=( $(compgen -W "$LABELS" -- $cur) ) + COMPREPLY=( $(compgen -W "$(swapon --show=LABEL --noheading)" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') @@ -46,9 +32,7 @@ _swapoff_module() return 0 ;; esac - local DEVS - DEVS="$(swapon --show=NAME --raw --noheading)" - COMPREPLY=( $(compgen -W "$DEVS" -- $cur) ) + COMPREPLY=( $(compgen -W "$(swapon --show=NAME --raw --noheading)" -- $cur) ) return 0 } complete -F _swapoff_module swapoff |