tools: add playbook driver switch
[barry/progweb.git] / bash / btool
blob8af3179900088ffd95aeadc2990ebac0d3664a4d
1 # -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
2 # ex: ts=8 sw=8 noet filetype=sh
4 # btool(1) completion by Ryan Li <ryan@ryanium.com>
6 have btool &&
7 _btool()
9         local cur prev
11         COMPREPLY=()
12         cur=`_get_cword`
14         if [[ COMP_CWORD -eq 1 || "$cur" == -* ]]; then
15                 COMPREPLY=( $( compgen -W '-B -N -a -c -C -d -e -h -i -l -L 
16                         -m -M -n -p -P -s -S -t -T -v -X -z -Z' -- "$cur" ) )
17         else
18                 prev=${COMP_WORDS[COMP_CWORD-1]}
20                 case "$prev" in
21                 -f)
22                         _filedir
23                         return 0
24                         ;;
25                 -i)
26                         COMPREPLY=( $( compgen -W \
27                                 '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
28                         return 0
29                         ;;
30                 -p)
31                         COMPREPLY=( $( compgen -W \
32                                 '$( bidentify | sed -e "s/,.*$//" )' \
33                                 -- "$cur" ) )
34                         return 0
35                         ;;
36                 *)
37                         ;;
38                 esac
39         fi
40 } &&
41 complete -F _btool btool