Split kill, look, and renice completions into contrib/util-linux.

master
Ville Skyttä 2010-06-09 22:40:31 +03:00
parent bf0ec3ce0e
commit 77af9f50d3
4 changed files with 78 additions and 68 deletions

View File

@ -58,6 +58,7 @@ bash-completion (2.x)
* Split mount and umount completion into contrib/mount.
* 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.
* Do basic HTML file completion with Firefox and Chrome and friends,
and Epiphany.
* Do basic diff/patch completion with cdiff and kompare.

View File

@ -145,6 +145,7 @@ bashcomp_DATA = contrib/abook \
contrib/unace \
contrib/unrar \
contrib/update-alternatives \
contrib/util-linux \
contrib/vncviewer \
contrib/vpnc \
contrib/wireless-tools \

View File

@ -1081,58 +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
# renice(8) completion
#
_renice()
{
local command cur curopt i
COMPREPLY=()
cur=`_get_cword`
command=$1
i=0
# walk back through command line and find last option
while [[ $i -le $COMP_CWORD && ${#COMPREPLY[@]} -eq 0 ]]; do
curopt=${COMP_WORDS[COMP_CWORD-$i]}
case "$curopt" in
-u)
COMPREPLY=( $( compgen -u -- "$cur" ) )
;;
-g)
_pgids
;;
-p|$command)
_pids
;;
esac
i=$(( ++i ))
done
}
complete -F _renice renice
# kill(1) completion
#
_kill()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then
# return list of available signals
_signals
else
# return list of available PIDs
_pids
fi
}
complete -F _kill kill
# killall(1) (Linux and FreeBSD) and pkill(1) completion.
#
[[ $UNAME == Linux || $UNAME == FreeBSD ]] || have pkill &&
@ -1648,22 +1596,6 @@ for i in env netstat seq uname units; do
done
unset i
# look(1) completion
#
have look &&
_look()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [ $COMP_CWORD = 1 ]; then
COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) )
fi
} &&
complete -F _look -o default look
_filedir_xspec()
{
local IFS cur xspec

76
contrib/util-linux Normal file
View File

@ -0,0 +1,76 @@
# Completions for tools included in util-linux (not necessarily Linux specific)
# renice(8) completion
#
have renice &&
_renice()
{
local command cur curopt i
COMPREPLY=()
cur=`_get_cword`
command=$1
i=0
# walk back through command line and find last option
while [[ $i -le $COMP_CWORD && ${#COMPREPLY[@]} -eq 0 ]]; do
curopt=${COMP_WORDS[COMP_CWORD-$i]}
case "$curopt" in
-u)
COMPREPLY=( $( compgen -u -- "$cur" ) )
;;
-g)
_pgids
;;
-p|$command)
_pids
;;
esac
i=$(( ++i ))
done
} &&
complete -F _renice renice
# kill(1) completion
#
have kill &&
_kill()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then
# return list of available signals
_signals
else
# return list of available PIDs
_pids
fi
} &&
complete -F _kill kill
# look(1) completion
#
have look &&
_look()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [ $COMP_CWORD = 1 ]; then
COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) )
fi
} &&
complete -F _look -o default look
# 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