Add storage options to bash completion

Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
Harald Albers 2015-08-12 05:51:07 -07:00 committed by Tibor Vass
parent 0f17194e5f
commit cefc964f4c
1 changed files with 52 additions and 1 deletions

View File

@ -139,7 +139,7 @@ __docker_value_of_option() {
local counter=$((command_pos + 1)) local counter=$((command_pos + 1))
while [ $counter -lt $cword ]; do while [ $counter -lt $cword ]; do
case ${words[$counter]} in case ${words[$counter]} in
$option_glob ) @($option_glob) )
echo ${words[$counter + 1]} echo ${words[$counter + 1]}
break break
;; ;;
@ -519,6 +519,38 @@ _docker_daemon() {
COMPREPLY=( $( compgen -W "aufs btrfs devicemapper overlay vfs zfs" -- "$(echo $cur | tr '[:upper:]' '[:lower:]')" ) ) COMPREPLY=( $( compgen -W "aufs btrfs devicemapper overlay vfs zfs" -- "$(echo $cur | tr '[:upper:]' '[:lower:]')" ) )
return return
;; ;;
--storage-opt)
local devicemapper_options="
dm.basesize
dm.blkdiscard
dm.blocksize
dm.fs
dm.loopdatasize
dm.loopmetadatasize
dm.mkfsarg
dm.mountopt
dm.override_udev_sync_check
dm.thinpooldev
"
local zfs_options="zfs.fsname"
case $(__docker_value_of_option '--storage-driver|-s') in
'')
COMPREPLY=( $( compgen -W "$devicemapper_options $zfs_options" -S = -- "$cur" ) )
;;
devicemapper)
COMPREPLY=( $( compgen -W "$devicemapper_options" -S = -- "$cur" ) )
;;
zfs)
COMPREPLY=( $( compgen -W "$zfs_options" -S = -- "$cur" ) )
;;
*)
return
;;
esac
compopt -o nospace
return
;;
--log-level|-l) --log-level|-l)
__docker_log_levels __docker_log_levels
return return
@ -532,6 +564,25 @@ _docker_daemon() {
;; ;;
esac esac
case "${words[$cword-2]}$prev=" in
*dm.blkdiscard=*)
COMPREPLY=( $( compgen -W "false true" -- "${cur#=}" ) )
return
;;
*dm.fs=*)
COMPREPLY=( $( compgen -W "ext4 xfs" -- "${cur#=}" ) )
return
;;
*dm.override_udev_sync_check=*)
COMPREPLY=( $( compgen -W "false true" -- "${cur#=}" ) )
return
;;
*dm.thinpooldev=*)
_filedir
return
;;
esac
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )