| 1 |
# bash completion for Debian ola-rdm-tests tools |
| 2 |
# Copyright Peter Newman 2013, based on apache2 and apt-file completion |
| 3 |
|
| 4 |
#Commands |
| 5 |
#rdm_responder_test.py |
| 6 |
have rdm_responder_test.py && _rdm_responder_test.py() |
| 7 |
{ |
| 8 |
local cur prev opts |
| 9 |
|
| 10 |
COMPREPLY=() |
| 11 |
cur=${COMP_WORDS[COMP_CWORD]} |
| 12 |
prev=${COMP_WORDS[COMP_CWORD-1]} |
| 13 |
opts='--slot-count --debug --dmx-frame-rate --log --list-tests --pid-location --skip-check --tests --timestamp --no-factory-defaults --broadcast-write-delay --universe --inter-test-delay' |
| 14 |
|
| 15 |
case "$prev" in |
| 16 |
-l | --log) |
| 17 |
#Log wants a file |
| 18 |
#We're not interested in supplying opts, so set compreply and break out with a return |
| 19 |
_filedir |
| 20 |
return 0 |
| 21 |
;; |
| 22 |
-p | --pid-location) |
| 23 |
#pid-location wants a directory |
| 24 |
#We're not interested in supplying opts, so set compreply and break out with a return |
| 25 |
_filedir -d |
| 26 |
return 0 |
| 27 |
;; |
| 28 |
-t | --tests) |
| 29 |
#TODO: Get this working with the comma separated list of tests |
| 30 |
#We're not interested in supplying opts, so set compreply and break out with a return |
| 31 |
COMPREPLY=( $( compgen -W '$( command ${COMP_WORDS[0]} --list-tests 2>/dev/null )' -- $cur ) ) |
| 32 |
return 0; |
| 33 |
;; |
| 34 |
esac; |
| 35 |
|
| 36 |
COMPREPLY=($( compgen -W "$opts" -- $cur ) ) |
| 37 |
|
| 38 |
return 0 |
| 39 |
} |
| 40 |
complete -F _rdm_responder_test.py rdm_responder_test.py |
| 41 |
|
| 42 |
#rdm_model_collector.py |
| 43 |
have rdm_model_collector.py && _rdm_model_collector.py() |
| 44 |
{ |
| 45 |
local cur prev opts |
| 46 |
|
| 47 |
COMPREPLY=() |
| 48 |
cur=${COMP_WORDS[COMP_CWORD]} |
| 49 |
prev=${COMP_WORDS[COMP_CWORD-1]} |
| 50 |
opts='--debug --pid-location --skip-queued-messages --universe' |
| 51 |
|
| 52 |
case "$prev" in |
| 53 |
-p | --pid-location) |
| 54 |
#Pid location wants a directory |
| 55 |
#We're not interested in supplying opts, so set compreply and break out with a return |
| 56 |
_filedir -d |
| 57 |
return 0 |
| 58 |
;; |
| 59 |
esac; |
| 60 |
|
| 61 |
COMPREPLY=($( compgen -W "$opts" -- $cur ) ) |
| 62 |
|
| 63 |
return 0 |
| 64 |
} |
| 65 |
complete -F _rdm_model_collector.py rdm_model_collector.py |
| 66 |
|
| 67 |
#rdm_test_server.py |
| 68 |
have rdm_test_server.py && _rdm_test_server.py() |
| 69 |
{ |
| 70 |
local cur prev opts |
| 71 |
|
| 72 |
COMPREPLY=() |
| 73 |
cur=${COMP_WORDS[COMP_CWORD]} |
| 74 |
prev=${COMP_WORDS[COMP_CWORD-1]} |
| 75 |
opts='--pid-location --www-dir --log-directory --world-writeable' |
| 76 |
|
| 77 |
case "$prev" in |
| 78 |
-p | --pid-location) |
| 79 |
#pid-location wants a directory |
| 80 |
#We're not interested in supplying opts, so set compreply and break out with a return |
| 81 |
_filedir -d |
| 82 |
return 0 |
| 83 |
;; |
| 84 |
-d | --www-dir | -l | --log-directory) |
| 85 |
#WWW dir and log dir want directories |
| 86 |
#We're not interested in supplying opts, so set compreply and break out with a return |
| 87 |
_filedir -d |
| 88 |
return 0 |
| 89 |
;; |
| 90 |
esac; |
| 91 |
|
| 92 |
COMPREPLY=($( compgen -W "$opts" -- $cur ) ) |
| 93 |
|
| 94 |
return 0 |
| 95 |
} |
| 96 |
complete -F _rdm_test_server.py rdm_test_server.py |