summaryrefslogtreecommitdiff
path: root/bash-completion/blockdev
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2013-04-05 14:58:07 +0200
committerKarel Zak <kzak@redhat.com>2013-04-05 14:58:07 +0200
commit20da58084a68b118b15fa01228192463b61fa28f (patch)
tree07beea113d5a68749264ad59e4d17fbc4bf9fe1d /bash-completion/blockdev
parentaead7c7e690ab019e0706f228a226b8c17eeab38 (diff)
downloadutil-linux-20da58084a68b118b15fa01228192463b61fa28f.tar.gz
bash-completion: rename shell-completion -> bash-completion
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'bash-completion/blockdev')
-rw-r--r--bash-completion/blockdev44
1 files changed, 44 insertions, 0 deletions
diff --git a/bash-completion/blockdev b/bash-completion/blockdev
new file mode 100644
index 00000000..ce986cb4
--- /dev/null
+++ b/bash-completion/blockdev
@@ -0,0 +1,44 @@
+_blockdev_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ OPTS="-h -V -q
+ --report
+ --getsz
+ --setro
+ --setrw
+ --getro
+ --getdiscardzeroes
+ --getss
+ --getpbsz
+ --getiomin
+ --getioopt
+ --getalignoff
+ --getmaxsect
+ --getbsz
+ --setbsz
+ --getsize64
+ --setra
+ --getra
+ --setfra
+ --getfra
+ --flushbufs
+ --rereadpt
+ $DEVS"
+ case $prev in
+ '--setbsz')
+ COMPREPLY=( $(compgen -W "bytes" -- $cur) )
+ return 0
+ ;;
+ '--setbsz'|'--setfra')
+ COMPREPLY=( $(compgen -W "sectors" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _blockdev_module blockdev