Split kill, look, and renice completions into contrib/util-linux.
This commit is contained in:
parent
bf0ec3ce0e
commit
77af9f50d3
1
CHANGES
1
CHANGES
@ -58,6 +58,7 @@ bash-completion (2.x)
|
|||||||
* Split mount and umount completion into contrib/mount.
|
* Split mount and umount completion into contrib/mount.
|
||||||
* Split service completion into contrib/service.
|
* Split service completion into contrib/service.
|
||||||
* Split chown, chgrp, and id completions into contrib/coreutils.
|
* 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,
|
* Do basic HTML file completion with Firefox and Chrome and friends,
|
||||||
and Epiphany.
|
and Epiphany.
|
||||||
* Do basic diff/patch completion with cdiff and kompare.
|
* Do basic diff/patch completion with cdiff and kompare.
|
||||||
|
@ -145,6 +145,7 @@ bashcomp_DATA = contrib/abook \
|
|||||||
contrib/unace \
|
contrib/unace \
|
||||||
contrib/unrar \
|
contrib/unrar \
|
||||||
contrib/update-alternatives \
|
contrib/update-alternatives \
|
||||||
|
contrib/util-linux \
|
||||||
contrib/vncviewer \
|
contrib/vncviewer \
|
||||||
contrib/vpnc \
|
contrib/vpnc \
|
||||||
contrib/wireless-tools \
|
contrib/wireless-tools \
|
||||||
|
@ -1081,58 +1081,6 @@ _dvd_devices()
|
|||||||
[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list extract \
|
[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list extract \
|
||||||
patch configure build install reinstall deinstall clean clean-depends \
|
patch configure build install reinstall deinstall clean clean-depends \
|
||||||
kernel buildworld' make
|
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.
|
# killall(1) (Linux and FreeBSD) and pkill(1) completion.
|
||||||
#
|
#
|
||||||
[[ $UNAME == Linux || $UNAME == FreeBSD ]] || have pkill &&
|
[[ $UNAME == Linux || $UNAME == FreeBSD ]] || have pkill &&
|
||||||
@ -1648,22 +1596,6 @@ for i in env netstat seq uname units; do
|
|||||||
done
|
done
|
||||||
unset i
|
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()
|
_filedir_xspec()
|
||||||
{
|
{
|
||||||
local IFS cur xspec
|
local IFS cur xspec
|
||||||
|
76
contrib/util-linux
Normal file
76
contrib/util-linux
Normal 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
|
Loading…
x
Reference in New Issue
Block a user