1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
# mfiutil completion -*- shell-script -*-
[[ $OSTYPE == *@(freebsd|dragonflybsd|darwin|linux|solaris)* ]] || return 1
_comp_cmd_mfiutil()
{
local cur prev words cword comp_args
_comp_initialize -- "$@" || return
if [[ $cur == -* ]]; then
# Complete global options
local options="-u -d -e"
case "$OSTYPE" in
*freebsd*)
options+=" -D -t"
;;
*dragonflybsd* | *solaris*)
options+=" -t"
;;
esac
local end_of_options=
local w
for w in "${words[@]:1:cword-1}"; do
case "$w" in
--)
end_of_options=set
break
;;
-*) ;;
*)
end_of_options=set
break
;;
esac
done
if [[ ! $end_of_options ]]; then
_comp_compgen -- -W '$options'
return
fi
fi
local REPLY
_comp_count_args -a "-*[Dtu]"
case $REPLY in
0)
# Complete argument to global options
case "$prev" in
-D)
_comp_compgen_filedir
;;
-t)
case "$OSTYPE" in
*freebsd* | *dragonflybsd*)
_comp_compgen -- -W 'mfi mrsas'
;;
esac
;;
esac
;;
1)
_comp_compgen -- -W '
version show fail good rebuild syspd drive start abort locate
cache name volume clear create delete add remove patrol stop
foreign flash bbu ctrlprop'
;;
2)
case "$prev" in
show)
_comp_compgen -- -W '
adapter battery config drives events firmware foreign
logstate volumes patrol progress'
;;
drive)
_comp_compgen -- -W 'progress clear'
;;
start)
_comp_compgen -- -W 'rebuild patrol learn'
;;
abort)
_comp_compgen -- -W 'rebuild'
;;
volume)
_comp_compgen -- -W 'progress'
;;
create)
_comp_compgen -- -W '
jbod raid0 raid1 raid5 raid6 raid10 raid50 raid60 concat'
;;
patrol)
_comp_compgen -- -W 'disable auto manual'
;;
stop)
_comp_compgen -- -W 'patrol'
;;
foreign)
_comp_compgen -- -W 'scan clear diag preview import'
;;
flash)
_comp_compgen_filedir
;;
bbu)
_comp_compgen -- -W 'learn-delay autolearn-mode bbu-mode'
;;
ctrlprop)
_comp_compgen -- -W 'rebuild alarm'
;;
esac
;;
3)
case "${words[cword - 2]}.$prev" in
locate.*)
_comp_compgen -- -W 'on off'
;;
cache.*)
_comp_compgen -- -W '
enable disable reads writes write-back write-through
read-ahead bad-bbu-write-cache write-cache'
;;
ctrlprop.alarm)
_comp_compgen -- -W 'on off 1 0'
;;
esac
;;
esac
} &&
complete -F _comp_cmd_mfiutil mfiutil mrsasutil
|