summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Murzov <e-mail@date.by>2011-11-07 02:04:06 +0300
committerIgor Murzov <e-mail@date.by>2011-11-07 02:04:06 +0300
commitefa8a9554fcf24c3babdeee858e2592177184e11 (patch)
tree9904900fd442c74b5448e05effecf5240fd62fcd
parentbc2d3c9a34a276a53baa6e836b0e171f56a1d97a (diff)
downloadbash-completion-efa8a9554fcf24c3babdeee858e2592177184e11.tar.gz
service, _services: Move _services() to completions/service.
-rw-r--r--bash_completion32
-rw-r--r--completions/chkconfig4
-rw-r--r--completions/service26
3 files changed, 31 insertions, 31 deletions
diff --git a/bash_completion b/bash_completion
index 1ef70305..bfd38a27 100644
--- a/bash_completion
+++ b/bash_completion
@@ -47,6 +47,10 @@ readonly BASH_COMPLETION_COMPAT_DIR
#
_blacklist_glob='@(acroread.sh)'
+# Glob for matching various backup files.
+#
+_backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))'
+
# Turn on extended globbing and programmable completion
shopt -s extglob progcomp
@@ -1035,34 +1039,6 @@ _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()
-{
- 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
-
- COMPREPLY=( $( printf '%s\n' $sysvdir/!($_backup_glob|functions) ) )
-
- if [ -d $famdir ]; then
- COMPREPLY+=( $( printf '%s\n' $famdir/!($_backup_glob) ) )
- fi
-
- $restore_nullglob
-
- COMPREPLY+=( $( systemctl list-units --full --all 2>/dev/null | \
- awk '$1 ~ /\.service$/ { sub("\\.service$", "", $1); print $1 }' ) )
-
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
-}
-
# This function completes on modules
#
_modules()
diff --git a/completions/chkconfig b/completions/chkconfig
index 31a575e3..3da4d43c 100644
--- a/completions/chkconfig
+++ b/completions/chkconfig
@@ -7,7 +7,7 @@ _chkconfig()
case $prev in
--level=[1-6]|[1-6]|--list|--add|--del|--override)
- _services
+ _xfunc service _services
return 0
;;
--level)
@@ -24,7 +24,7 @@ _chkconfig()
if [[ $cword -eq 2 || $cword -eq 4 ]]; then
COMPREPLY=( $( compgen -W 'on off reset resetpriorities' -- "$cur" ) )
else
- _services
+ _xfunc service _services
fi
fi
} &&
diff --git a/completions/service b/completions/service
index f008770e..bccb17cd 100644
--- a/completions/service
+++ b/completions/service
@@ -1,9 +1,33 @@
# service(8) and /etc/init.d/* completion -*- shell-script -*-
+# This function completes on services
+#
+_services()
+{
+ 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
+
+ COMPREPLY=( $( printf '%s\n' $sysvdir/!($_backup_glob|functions) ) )
+
+ if [ -d $famdir ]; then
+ COMPREPLY+=( $( printf '%s\n' $famdir/!($_backup_glob) ) )
+ fi
+
+ $restore_nullglob
+
+ COMPREPLY+=( $( systemctl list-units --full --all 2>/dev/null | \
+ awk '$1 ~ /\.service$/ { sub("\\.service$", "", $1); print $1 }' ) )
+
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
+}
+
# This completes on a list of all available service scripts for the
# 'service' command and/or the SysV init.d directory, followed by
# that script's available commands
-
+#
_service()
{
local cur prev words cword