diff options
author | Karel Zak | 2017-02-23 17:01:29 +0100 |
---|---|---|
committer | Karel Zak | 2017-02-23 17:01:29 +0100 |
commit | 6324d0f494b214244c3a2aa0b4ac785a3b069136 (patch) | |
tree | 0cb30c26636755764afce304dcea7744c7932f1f /bash-completion | |
parent | blkzone: add new command (merge blkreport and blkreset) (diff) | |
download | kernel-qcow2-util-linux-6324d0f494b214244c3a2aa0b4ac785a3b069136.tar.gz kernel-qcow2-util-linux-6324d0f494b214244c3a2aa0b4ac785a3b069136.tar.xz kernel-qcow2-util-linux-6324d0f494b214244c3a2aa0b4ac785a3b069136.zip |
blkzone: add bash-completion
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'bash-completion')
-rw-r--r-- | bash-completion/Makemodule.am | 3 | ||||
-rwxr-xr-x | bash-completion/blkzone | 48 |
2 files changed, 51 insertions, 0 deletions
diff --git a/bash-completion/Makemodule.am b/bash-completion/Makemodule.am index 89ae8ddac..3ffd124dc 100644 --- a/bash-completion/Makemodule.am +++ b/bash-completion/Makemodule.am @@ -252,6 +252,9 @@ endif if BUILD_BLKDISCARD dist_bashcompletion_DATA += bash-completion/blkdiscard endif +if BUILD_BLKZONE +dist_bashcompletion_DATA += bash-completion/blkzone +endif if BUILD_CTRLALTDEL dist_bashcompletion_DATA += bash-completion/ctrlaltdel endif diff --git a/bash-completion/blkzone b/bash-completion/blkzone new file mode 100755 index 000000000..d161cd0b8 --- /dev/null +++ b/bash-completion/blkzone @@ -0,0 +1,48 @@ +_blkzone_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-o'|'--offset') + COMPREPLY=( $(compgen -W "sector" -- $cur) ) + return 0 + ;; + '-l'|'--length') + COMPREPLY=( $(compgen -W "size" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + case $prev in + 'report'|'reset') + OPTS="--verbose --offset --length" + ;; + *) + OPTS="--help --version" + ;; + esac + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + *) + case $prev in + 'report'|'reset') + ;; + *) + OPTS="report reset" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + ;; + esac + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _blkzone_module blkzone |