1 # autorandr/auto-disper completion by Maciej 'macieks' Sitarz <macieks@freesco.pl>
5 local cur prev opts lopts prfls
8 cur="${COMP_WORDS[COMP_CWORD]}"
9 prev="${COMP_WORDS[COMP_CWORD-1]}"
12 lopts="--help --change --save --load --default --force --fingerprint --config --dry-run"
13 if [ -d ~/.autorandr ]; then
14 prfls="`find ~/.autorandr/* -maxdepth 1 -type d -printf '%f\n'`"
15 elif [ -d ~/.config/autorandr ]; then
16 prfls="`find ~/.config/autorandr/* -maxdepth 1 -type d -printf '%f\n'`"
23 COMPREPLY=( $( compgen -W "${lopts}" -- $cur ) )
27 COMPREPLY=( $( compgen -W "${opts} ${lopts}" -- $cur ) )
31 if [ $COMP_CWORD -eq 1 ]; then
32 COMPREPLY=( $( compgen -W "${opts} ${lopts}" -- $cur ) )
38 -l|--load|-d|--default)
39 COMPREPLY=( $( compgen -W "${prfls}" -- $cur ) )
48 complete -F _autorandr autorandr