Split killall, pkill, pgrep and related completions into contrib/procps.

master
Ville Skyttä 2010-06-09 22:47:42 +03:00
parent 77af9f50d3
commit 3f1f6120d7
8 changed files with 93 additions and 39 deletions

View File

@ -59,6 +59,7 @@ bash-completion (2.x)
* Split service completion into contrib/service.
* Split chown, chgrp, and id completions into contrib/coreutils.
* Split kill, look, and renice completions into contrib/util-linux.
* Split killall, pkill, pgrep and related completions into contrib/procps.
* Do basic HTML file completion with Firefox and Chrome and friends,
and Epiphany.
* Do basic diff/patch completion with cdiff and kompare.

View File

@ -110,6 +110,7 @@ bashcomp_DATA = contrib/abook \
contrib/postfix \
contrib/postgresql \
contrib/povray \
contrib/procps \
contrib/python \
contrib/qdbus \
contrib/qemu \

View File

@ -1081,45 +1081,6 @@ _dvd_devices()
[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list extract \
patch configure build install reinstall deinstall clean clean-depends \
kernel buildworld' make
# killall(1) (Linux and FreeBSD) and pkill(1) completion.
#
[[ $UNAME == Linux || $UNAME == FreeBSD ]] || have pkill &&
_killall()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then
_signals
else
_pnames
fi
return 0
}
[[ $UNAME == Linux || $UNAME == FreeBSD ]] && complete -F _killall killall
have pkill && complete -F _killall pkill
# pgrep(1) completion.
#
[ $UNAME = Linux ] || have pgrep &&
_pgrep()
{
local cur
COMPREPLY=()
cur=`_get_cword`
_pnames
return 0
}
have pgrep && complete -F _pgrep pgrep
# Linux pidof(8) completion.
[ $UNAME = Linux ] && complete -F _pgrep pidof
# Red Hat & Debian GNU/Linux if{up,down} completion
#

49
contrib/procps Normal file
View File

@ -0,0 +1,49 @@
# Completions for tools included in procps and related
# killall(1) (Linux and FreeBSD) and pkill(1) completion.
#
[[ $UNAME == Linux || $UNAME == FreeBSD ]] || have pkill &&
_killall()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then
_signals
else
_pnames
fi
return 0
}
[[ $UNAME == Linux || $UNAME == FreeBSD ]] && complete -F _killall killall
have pkill && complete -F _killall pkill
# pgrep(1) completion.
#
[ $UNAME = Linux ] || have pgrep &&
_pgrep()
{
local cur
COMPREPLY=()
cur=`_get_cword`
_pnames
return 0
}
have pgrep && complete -F _pgrep pgrep
# Linux pidof(8) completion.
[ $UNAME = Linux ] && complete -F _pgrep pidof
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -0,0 +1 @@
assert_source_completions pgrep

View File

@ -0,0 +1 @@
assert_source_completions pkill

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "pgrep "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "pkill "
sync_after_int
teardown