1588a27e21ab8390171aea3408c7e6535a471e8c
[booh] / booh.bash-completion
1 # bash completion for booh
2
3 _booh-backend()
4 {
5         local cur prev
6
7         COMPREPLY=()
8         cur=${COMP_WORDS[COMP_CWORD]}
9         prev=${COMP_WORDS[COMP_CWORD-1]}
10
11         case $prev in
12                 -@(s|d|-source|-destination))
13                         _filedir -d
14                         return 0
15                         ;;
16                 -@(C|M|N|u|-config|-merge-config|-merge-config-newdirs|-use-config))
17                         _filedir
18                         return 0
19                         ;;
20                 -@(t|-theme))
21                         COMPREPLY=( $( command ls /usr/share/booh/themes | grep "^$cur" ) )
22                         return 0
23                         ;;
24                 -@(m|-mproc))
25                         COMPREPLY=( $( grep -c 'processor' /proc/cpuinfo | grep "^$cur" ) )
26                         return 0
27                         ;;
28         esac
29
30         if [[ "$cur" == -* ]]; then
31                 COMPREPLY=( $( compgen -W '-h --help -V --version -n \
32                         --no-check -s --source -d --destination -t \
33                         --theme -C --config -k --config-skel -M \
34                         --merge-config -N --merge-config-newdirs -u \
35                         --use-config -S --sizes -m --mproc -g \
36                         --for-gui -v --verbose-level' -- $cur ) )
37         fi
38 }
39 complete -F _booh-backend booh-backend