[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-51-g4d3e9d0
Ville Skyttä
ville.skytta at iki.fi
Fri Apr 1 17:24:03 UTC 2011
The following commit has been merged in the master branch:
commit 4d3e9d092cee3e0ae80d50443cb51f4cad1dc1e4
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Fri Apr 1 20:22:10 2011 +0300
Add $_backup_glob for matching various backup files and reuse it.
Compared to the previous embedded/duplicated globs, this one
additionally treats *.orig and *.rej as backup files.
diff --git a/CHANGES b/CHANGES
index b26a399..f30e352 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,7 @@ bash-completion (2.x)
* Try harder to find the correct perl executable to run the perl helper with.
* Drop rpm query support for rpm < 4.1.
* Split rpm and rpmbuild completions and improve them both.
+ * Add $_backup_glob for matching various backup files.
[ Guillaume Rousse ]
* added puppet completion, using work from Mathieu Parent (sathieudebian.org)
diff --git a/bash_completion b/bash_completion
index 2b05b80..3db6dda 100644
--- a/bash_completion
+++ b/bash_completion
@@ -961,6 +961,10 @@ _gids()
fi
}
+# Glob for matching various backup files.
+#
+_backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))'
+
# This function completes on services
#
_services()
@@ -968,12 +972,11 @@ _services()
local sysvdir famdir
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
famdir=/etc/xinetd.d
- COMPREPLY=( $( printf '%s\n' \
- $sysvdir/!(*.rpm@(orig|new|save)|*~|functions) ) )
+ COMPREPLY=( $( printf '%s\n' $sysvdir/!($_backup_glob|functions) ) )
if [ -d $famdir ]; then
COMPREPLY=( "${COMPREPLY[@]}" $( printf '%s\n' \
- $famdir/!(*.rpm@(orig|new|save)|*~) ) )
+ $famdir/!($_backup_glob) ) )
fi
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
@@ -1676,7 +1679,7 @@ if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \
-x $BASH_COMPLETION_COMPAT_DIR ]]; then
for i in $(LC_ALL=C command ls "$BASH_COMPLETION_COMPAT_DIR"); do
i=$BASH_COMPLETION_COMPAT_DIR/$i
- [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \
+ [[ ${i##*/} != @($_backup_glob|Makefile*) \
&& -f $i && -r $i ]] && . "$i"
done
fi
@@ -1685,7 +1688,7 @@ if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \
-x $BASH_COMPLETION_DIR ]]; then
for i in $(LC_ALL=C command ls "$BASH_COMPLETION_DIR"); do
i=$BASH_COMPLETION_DIR/$i
- [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \
+ [[ ${i##*/} != @($_backup_glob|Makefile*) \
&& -f $i && -r $i ]] && . "$i"
done
fi
diff --git a/completions/sysv-rc b/completions/sysv-rc
index 735a404..94ca25a 100644
--- a/completions/sysv-rc
+++ b/completions/sysv-rc
@@ -12,7 +12,7 @@ _update_rc_d()
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
|| sysvdir=/etc/init.d
- services=( $(printf '%s ' $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
+ services=( $(printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob)) )
services=( ${services[@]#$sysvdir/} )
options=( -f -n )
@@ -76,8 +76,7 @@ _invoke_rc_d()
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
|| sysvdir=/etc/init.d
- services=( $( printf '%s ' \
- $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save)) ) )
+ services=( $( printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob) ) )
services=( ${services[@]#$sysvdir/} )
options=( --help --quiet --force --try-anyway --disclose-deny --query \
--no-fallback )
--
bash-completion
More information about the Bash-completion-commits
mailing list