]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blob - bash_completion/autorandr
Merge remote-tracking branch 'public/patch-1'
[deb_pkgs/autorandr.git] / bash_completion / autorandr
1 # autorandr/auto-disper completion by Maciej 'macieks' Sitarz <macieks@freesco.pl>
2
3 _autorandr ()
4 {
5         local cur prev opts lopts prfls
6
7         COMPREPLY=()
8         cur="${COMP_WORDS[COMP_CWORD]}"
9         prev="${COMP_WORDS[COMP_CWORD-1]}"
10
11         opts="-h -c -s -l -d"
12         lopts="--help --change --save --load --default --force --fingerprint --config"
13         prfls="`find ~/.autorandr/* -maxdepth 1 -type d -printf '%f\n'`"
14
15         case "${cur}" in
16                 --*)
17                         COMPREPLY=( $( compgen -W "${lopts}" -- $cur ) )
18                         return 0
19                         ;;
20                 -*)
21                         COMPREPLY=( $( compgen -W "${opts} ${lopts}" -- $cur ) )
22                         return 0
23                         ;;
24                 *)
25                         if [ $COMP_CWORD -eq 1 ]; then
26                                 COMPREPLY=( $( compgen -W "${opts} ${lopts}" -- $cur ) )
27                         fi
28                         ;;
29                 esac
30
31         case "${prev}" in
32                 -l|--load|-d|--default)
33                         COMPREPLY=( $( compgen -W "${prfls}" ) )
34                         return 0
35                         ;;
36                 *)
37                         ;;
38         esac
39
40         return 0
41 }
42 complete -F _autorandr autorandr
43 complete -F _autorandr auto-disper
44