[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-525-ge4cdcca
Igor Murzov
e-mail at date.by
Wed Nov 9 13:12:10 UTC 2011
The following commit has been merged in the master branch:
commit fff412b2f2b83e10de8644acbb90535355b39b93
Author: Igor Murzov <e-mail at date.by>
Date: Wed Nov 9 04:49:37 2011 +0300
Revert "Another stab at making service completion work on Slackware."
This reverts commit 1a01e54d856fe2d9496cfaf6d9df8b75d87a9b52.
See http://thread.gmane.org/gmane.comp.shells.bash.completion.scm/2278
diff --git a/bash_completion b/bash_completion
index 44f74c0..9a7eb9f 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1043,12 +1043,9 @@ _backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))'
#
_services()
{
- local sysvdir=/etc/init.d famdir=/etc/xinetd.d
- if [[ -d /etc/rc.d/init.d ]]; then
- sysvdir=/etc/rc.d/init.d
- elif [[ -f /etc/slackware-version ]]; then
- sysvdir=/etc/rc.d
- fi
+ local sysvdir famdir
+ [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
+ famdir=/etc/xinetd.d
local restore_nullglob=$(shopt -p nullglob); shopt -s nullglob
@@ -1841,8 +1838,7 @@ _completion_loader()
[[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions"
# Special case for init.d scripts.
- if [[ $1 == /etc?(/rc.d)/init.d/* || \
- ( $1 == /etc/rc.d/* && -f /etc/slackware-version ) ]]; then
+ if [[ $1 == /etc?(/rc.d)/init.d/* ]]; then
. "$compdir/service" &>/dev/null && return 124 || return 1
fi
diff --git a/completions/service b/completions/service
index e359ef4..f008770 100644
--- a/completions/service
+++ b/completions/service
@@ -15,12 +15,9 @@ _service()
if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then
_services
else
- local sysvdir=/etc/init.d
- if [[ -d /etc/rc.d/init.d ]]; then
- sysvdir=/etc/rc.d/init.d
- elif [[ -f /etc/slackware-version ]]; then
- sysvdir=/etc/rc.d
- fi
+ local sysvdir
+ [ -d /etc/rc.d/init.d ] && \
+ sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
$sysvdir/${prev##*/} 2>/dev/null` start stop' -- "$cur" ) )
@@ -29,14 +26,9 @@ _service()
return 0
} &&
complete -F _service service
-
-svcdirs=( /etc/init.d /etc/rc.d/init.d )
-[[ -f /etc/slackware-version ]] && svcdirs=( /etc/rc.d )
-for svcdir in ${svcdirs[@]}; do
- for svc in $svcdir/!($_backup_glob); do
- [ -x "$svc" ] && complete -F _service $svc
- done
+for svc in /etc/init.d/!($_backup_glob) /etc/rc.d/init.d/!($_backup_glob); do
+ [ -x "$svc" ] && complete -F _service $svc
done
-unset svc svcdir svcdirs
+unset svc
# ex: ts=4 sw=4 et filetype=sh
--
bash-completion
More information about the Bash-completion-commits
mailing list