[Bash-completion-commits] [SCM] bash-completion branch, master, updated. b3f8e617ac7569a4c6bd3f3f6e6e3bc51d61d3f4
Guillaume Rousse
guillomovitch at zarb.org
Fri May 29 07:57:23 UTC 2009
The following commit has been merged in the master branch:
commit c2b44b5fe5d43a7aede894a73147a280baf96b10
Author: Guillaume Rousse <guillomovitch at zarb.org>
Date: Wed May 27 18:39:19 2009 +0200
split xrandr completion
diff --git a/Makefile.am b/Makefile.am
index 6ef21a0..90b9a4b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -98,6 +98,7 @@ bashcomp_DATA = contrib/ant \
contrib/xhost \
contrib/xm \
contrib/xmllint \
+ contrib/xrandr \
contrib/yum
EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA) to_review
diff --git a/bash_completion b/bash_completion
index 430a148..4dee977 100644
--- a/bash_completion
+++ b/bash_completion
@@ -4396,54 +4396,6 @@ _ypmatch()
} &&
complete -F _ypmatch ypmatch ypcat
-#xrandr(1) completion
-#
-have xrandr &&
-_xrandr()
-{
- local cur prev output modes
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --output)
- local outputs=$(xrandr|grep 'connected'|awk '{print $1}')
- COMPREPLY=( $(compgen -W "$outputs" -- $cur))
- return 0
- ;;
- --mode)
- for(( i = 1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == "--output" ]]; then
- output=${COMP_WORDS[i+1]}
- break
- fi
- done
- modes=$(xrandr|sed -e "1,/$output/ d" \
- -e "/connected/,$ d"|awk '{print $1}')
- COMPREPLY=( $( compgen -W "$modes" -- $cur))
- return 0
- ;;
- esac
-
- case "$cur" in
- *)
- COMPREPLY=( $(compgen -W '-d -display -help -o \
- --orientation -q --query -s --size\
- -r --rate -v --version -x -y --screen \
- --verbose --dryrun --prop --fb --fbmm --dpi \
- --output --auto --mode --preferred --pos \
- --reflect --rotate --left-of --right-of \
- --above --below --same-as --set --off --crtc \
- --newmode --rmmode --addmode --delmode' -- $cur))
- return 0
- ;;
- esac
-
- return 0
-} &&
-complete -F _xrandr xrandr
-
# iconv(1) completion
#
have iconv &&
diff --git a/contrib/xrandr b/contrib/xrandr
new file mode 100644
index 0000000..3dbd928
--- /dev/null
+++ b/contrib/xrandr
@@ -0,0 +1,51 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for xrandr
+
+have xrandr &&
+_xrandr()
+{
+ local cur prev output modes
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ --output)
+ local outputs=$(xrandr|grep 'connected'|awk '{print $1}')
+ COMPREPLY=( $(compgen -W "$outputs" -- $cur))
+ return 0
+ ;;
+ --mode)
+ for(( i = 1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == "--output" ]]; then
+ output=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+ modes=$(xrandr|sed -e "1,/$output/ d" \
+ -e "/connected/,$ d"|awk '{print $1}')
+ COMPREPLY=( $( compgen -W "$modes" -- $cur))
+ return 0
+ ;;
+ esac
+
+ case "$cur" in
+ *)
+ COMPREPLY=( $(compgen -W '-d -display -help -o \
+ --orientation -q --query -s --size\
+ -r --rate -v --version -x -y --screen \
+ --verbose --dryrun --prop --fb \
+ --fbmm --dpi --output --auto --mode \
+ --preferred --pos --reflect --rotate \
+ --left-of --right-of --above --below \
+ --same-as --set --off --crtc --newmode \
+ --rmmode --addmode --delmode' -- $cur))
+ return 0
+ ;;
+ esac
+
+ return 0
+} &&
+complete -F _xrandr xrandr
--
bash-completion
More information about the Bash-completion-commits
mailing list