1
# mtx completion by Jon Middleton <jjm@ixtab.org.uk>
6
local cur prev options tapes drives
9
_get_comp_words_by_ref cur prev
11
options="-f nobarcode invert noattach --version inquiry noattach \
12
inventory status load unload eepos first last next"
14
tapes=$(mtx status | \
15
awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }')
18
drives=$(mtx status | \
19
awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }')
20
drives=${drives//:Full}
21
drives=${drives//:Empty}
23
if [ $COMP_CWORD -gt 1 ]; then
26
COMPREPLY=( $( compgen -W "$tapes" -- "$cur" ) )
28
unload|first|last|next)
29
COMPREPLY=( $( compgen -W "$drives" -- "$cur" ) )
39
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
48
# sh-indent-comment: t
49
# indent-tabs-mode: nil
51
# ex: ts=4 sw=4 et filetype=sh