]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blobdiff - bash_completion/autorandr
Use XDG Base Directory Specification for config files
[deb_pkgs/autorandr.git] / bash_completion / autorandr
index b00999452fdb4d4cb1b73ebc1ece66793858cccd..caa6b90b82e257c82efa2d78d670c22f0db3d49b 100644 (file)
@@ -9,8 +9,14 @@ _autorandr ()
        prev="${COMP_WORDS[COMP_CWORD-1]}"
 
        opts="-h -c -s -l -d"
-       lopts="--help --change --save --load --default --force --fingerprint"
-       prfls="`find ~/.autorandr/* -maxdepth 1 -type d -printf '%f\n'`"
+       lopts="--help --change --save --load --default --force --fingerprint --config --dry-run"
+       if [ -d ~/.autorandr ]; then
+               prfls="`find ~/.autorandr/* -maxdepth 1 -type d -printf '%f\n'`"
+       if [ -d ~/.config/autorandr ]; then
+               prfls="`find ~/.config/autorandr/* -maxdepth 1 -type d -printf '%f\n'`"
+       else
+               prfls=""
+       fi
 
        case "${cur}" in
                --*)
@@ -30,7 +36,7 @@ _autorandr ()
 
        case "${prev}" in
                -l|--load|-d|--default)
-                       COMPREPLY=( $( compgen -W "${prfls}" ) )
+                       COMPREPLY=( $( compgen -W "${prfls}" -- $cur ) )
                        return 0
                        ;;
                *)
@@ -40,5 +46,3 @@ _autorandr ()
        return 0
 }
 complete -F _autorandr autorandr
-complete -F _autorandr auto-disper
-