diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-08-03 18:43:14 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-08-03 18:43:14 -0300 |
commit | cc81eb120ad1a456f030f7b828697013a9b2b66a (patch) | |
tree | bb61702f98b407b2f7987faa846190fb3f002e55 /completions/mtx | |
parent | 8394526300cc384e53c470303aeb8b4fdcaf84a3 (diff) | |
parent | 95623d39d6029ba78ec96ad5ea08e9ac12629b91 (diff) | |
download | bash-completion-cc81eb120ad1a456f030f7b828697013a9b2b66a.tar.gz |
Update upstream source from tag 'upstream/2.11'
Update to upstream version '2.11'
with Debian dir 932c2c1a6192441f3cd8897e72d737f2f0277f60
Diffstat (limited to 'completions/mtx')
-rw-r--r-- | completions/mtx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/completions/mtx b/completions/mtx index 9266687c..b5c270bd 100644 --- a/completions/mtx +++ b/completions/mtx @@ -11,22 +11,22 @@ _mtx() options="-f nobarcode invert noattach --version inquiry noattach \ inventory status load unload eepos first last next" - tapes=$(mtx status 2>/dev/null | \ + tapes=$(mtx status 2>/dev/null | awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }') - tapes=${tapes//:Full} + tapes=${tapes//:Full/} - drives=$(mtx status 2>/dev/null | \ + drives=$(mtx status 2>/dev/null | awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }') - drives=${drives//:Full} - drives=${drives//:Empty} + drives=${drives//:Full/} + drives=${drives//:Empty/} - if [[ $cword -gt 1 ]]; then + if ((cword > 1)); then case $prev in load) - COMPREPLY=( $(compgen -W "$tapes" -- "$cur") ) + COMPREPLY=($(compgen -W "$tapes" -- "$cur")) ;; - unload|first|last|next) - COMPREPLY=( $(compgen -W "$drives" -- "$cur") ) + unload | first | last | next) + COMPREPLY=($(compgen -W "$drives" -- "$cur")) ;; -f) true @@ -36,9 +36,9 @@ _mtx() ;; esac else - COMPREPLY=( $(compgen -W "$options" -- "$cur") ) + COMPREPLY=($(compgen -W "$options" -- "$cur")) fi } && -complete -F _mtx mtx + complete -F _mtx mtx # ex: filetype=sh |