[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-114-g225b395

Ville Skyttä ville.skytta at iki.fi
Sat Feb 2 17:42:34 UTC 2013


The following commit has been merged in the master branch:
commit 225b395b494d8c4f2167429cc58256e5898d1d14
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Feb 2 19:42:24 2013 +0200

    xrandr: Avoid --mode completion error when --output is not given.

diff --git a/completions/xrandr b/completions/xrandr
index 757b658..643b11f 100644
--- a/completions/xrandr
+++ b/completions/xrandr
@@ -19,9 +19,11 @@ _xrandr()
                     break
                 fi
             done
-            local modes=$( xrandr | sed -e "1,/$output/ d" \
-                -e "/connected/,$ d" | awk '{print $1}' )
-            COMPREPLY=( $( compgen -W "$modes" -- "$cur" ) )
+            if [[ $output ]]; then
+                local modes=$( xrandr | sed -e "1,/$output/ d" \
+                    -e "/connected/,$ d" | awk '{print $1}' )
+                COMPREPLY=( $( compgen -W "$modes" -- "$cur" ) )
+            fi
             return
             ;;
         -o|--orientation)
diff --git a/test/lib/completions/xrandr.exp b/test/lib/completions/xrandr.exp
index 14beb76..e76a566 100644
--- a/test/lib/completions/xrandr.exp
+++ b/test/lib/completions/xrandr.exp
@@ -12,8 +12,9 @@ setup
 
 
 assert_complete_any "xrandr "
+sync_after_int
 
-
+assert_no_complete "xrandr --mode "
 sync_after_int
 
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list