fdd76fc5 |
1 | # bash completion for is_installed -*- shell-script -*- |
2 | |
3 | _is_installed() |
4 | { |
5 | local cur prev words cword |
6 | _init_completion -n = || return |
7 | |
8 | local split=false |
9 | |
10 | local i action |
11 | for (( i=1; i<${#words[@]}; i++ )); do |
12 | if [[ "${words[i]}" != -* ]]; then |
13 | action="${words[i]}" |
14 | break |
15 | fi |
16 | done |
17 | |
18 | case "$action" in |
19 | help) |
20 | # no argument required |
21 | return |
22 | ;; |
23 | info) |
24 | COMPREPLY=( $(cd /var/log/packages; compgen -f -- "$cur") ) |
25 | return |
26 | ;; |
27 | file-search) |
28 | # argument required but no way to help |
29 | return |
30 | ;; |
31 | *) |
32 | COMPREPLY+=( $(compgen -W 'help info file-search' -- "$cur") ) |
33 | return |
34 | ;; |
35 | esac |
36 | |
37 | } |
38 | |
39 | complete -F _is_installed is_installed |
40 | |
41 | # ex: filetype=sh |