diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2013-02-02 19:42:24 +0200 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2013-02-02 19:42:24 +0200 |
commit | 225b395b494d8c4f2167429cc58256e5898d1d14 (patch) | |
tree | 6c4dc3c431536d4d92437ab070b4b096c2e63891 | |
parent | a3d4266cab93e2dacf4fc058344f10a0e0860313 (diff) | |
download | bash-completion-225b395b494d8c4f2167429cc58256e5898d1d14.tar.gz |
xrandr: Avoid --mode completion error when --output is not given.
-rw-r--r-- | completions/xrandr | 8 | ||||
-rw-r--r-- | test/lib/completions/xrandr.exp | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/completions/xrandr b/completions/xrandr index 757b6589..643b11f5 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 14beb762..e76a5665 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 |