Jon Hall | 9e8c761 | 2016-07-18 17:40:06 -0700 | [diff] [blame^] | 1 | _teston-cases() |
| 2 | { |
| 3 | local dir=~/TestON |
| 4 | if [ ! -e $dir ] |
| 5 | then |
| 6 | echo |
| 7 | echo "ERROR: $dir does not exist" |
| 8 | return 1 |
| 9 | fi |
| 10 | local cur=${COMP_WORDS[COMP_CWORD]} |
| 11 | COMPREPLY=( $(compgen -o dirnames -W "$(find $dir/tests -name "*.params" | grep -v __init | grep -v dependencies | xargs dirname | xargs -0 | tr '\n' '\0' | xargs -l -0 basename)" -- $cur) ) |
| 12 | return 0 |
| 13 | } |
| 14 | _teston() |
| 15 | { |
| 16 | local dir=~/TestON |
| 17 | COMPREPLY=() |
| 18 | local cur=${COMP_WORDS[COMP_CWORD]} |
| 19 | local prev=${COMP_WORDS[COMP_CWORD-1]} |
| 20 | |
| 21 | case "$prev" in |
| 22 | run) |
| 23 | _teston-cases |
| 24 | return $?;; |
| 25 | teston | */cli.py ) |
| 26 | COMPREPLY=( $( compgen -W 'run' -- $cur ) ) |
| 27 | return 0;; |
| 28 | esac |
| 29 | return 0 |
| 30 | } |
| 31 | |
| 32 | |
| 33 | complete -F _teston "./cli.py" |
| 34 | complete -F _teston "teston" |