Merge branch 'master' into 1.x
This commit is contained in:
commit
aab38f6160
6
CHANGES
6
CHANGES
@ -56,6 +56,12 @@ bash-completion (2.x)
|
|||||||
* Protect grep invocations from user aliases (Alioth: 312143).
|
* Protect grep invocations from user aliases (Alioth: 312143).
|
||||||
* Split sshfs completion from contrib/ssh into contrib/sshfs.
|
* Split sshfs completion from contrib/ssh into contrib/sshfs.
|
||||||
* Split mount and umount completion into contrib/mount.
|
* 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.
|
||||||
|
* Split killall, pkill, pgrep and related completions into contrib/procps.
|
||||||
|
* Split ipsec completion into contrib/ipsec.
|
||||||
|
* Split ifup and ifdown completions into contrib/ifupdown.
|
||||||
* 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.
|
||||||
|
@ -25,6 +25,7 @@ bashcomp_DATA = contrib/abook \
|
|||||||
contrib/cksfv \
|
contrib/cksfv \
|
||||||
contrib/clisp \
|
contrib/clisp \
|
||||||
contrib/configure \
|
contrib/configure \
|
||||||
|
contrib/coreutils \
|
||||||
contrib/cowsay \
|
contrib/cowsay \
|
||||||
contrib/cpan2dist \
|
contrib/cpan2dist \
|
||||||
contrib/cpio \
|
contrib/cpio \
|
||||||
@ -54,10 +55,12 @@ bashcomp_DATA = contrib/abook \
|
|||||||
contrib/heimdal \
|
contrib/heimdal \
|
||||||
contrib/hping2 \
|
contrib/hping2 \
|
||||||
contrib/iconv \
|
contrib/iconv \
|
||||||
|
contrib/ifupdown \
|
||||||
contrib/imagemagick \
|
contrib/imagemagick \
|
||||||
contrib/info \
|
contrib/info \
|
||||||
contrib/iptables \
|
contrib/iptables \
|
||||||
contrib/ipmitool \
|
contrib/ipmitool \
|
||||||
|
contrib/ipsec \
|
||||||
contrib/ipv6calc \
|
contrib/ipv6calc \
|
||||||
contrib/isql \
|
contrib/isql \
|
||||||
contrib/jar \
|
contrib/jar \
|
||||||
@ -109,6 +112,7 @@ bashcomp_DATA = contrib/abook \
|
|||||||
contrib/postfix \
|
contrib/postfix \
|
||||||
contrib/postgresql \
|
contrib/postgresql \
|
||||||
contrib/povray \
|
contrib/povray \
|
||||||
|
contrib/procps \
|
||||||
contrib/python \
|
contrib/python \
|
||||||
contrib/qdbus \
|
contrib/qdbus \
|
||||||
contrib/qemu \
|
contrib/qemu \
|
||||||
@ -128,6 +132,7 @@ bashcomp_DATA = contrib/abook \
|
|||||||
contrib/samba \
|
contrib/samba \
|
||||||
contrib/sbcl \
|
contrib/sbcl \
|
||||||
contrib/screen \
|
contrib/screen \
|
||||||
|
contrib/service \
|
||||||
contrib/shadow \
|
contrib/shadow \
|
||||||
contrib/sitecopy \
|
contrib/sitecopy \
|
||||||
contrib/smartctl \
|
contrib/smartctl \
|
||||||
@ -143,10 +148,12 @@ 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 \
|
||||||
contrib/wodim \
|
contrib/wodim \
|
||||||
|
contrib/wol \
|
||||||
contrib/wtf \
|
contrib/wtf \
|
||||||
contrib/wvdial \
|
contrib/wvdial \
|
||||||
contrib/xhost \
|
contrib/xhost \
|
||||||
|
321
bash_completion
321
bash_completion
@ -1082,292 +1082,6 @@ _dvd_devices()
|
|||||||
patch configure build install reinstall deinstall clean clean-depends \
|
patch configure build install reinstall deinstall clean clean-depends \
|
||||||
kernel buildworld' make
|
kernel buildworld' make
|
||||||
|
|
||||||
# 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
|
|
||||||
#
|
|
||||||
{ have service || [ -d /etc/init.d/ ]; } &&
|
|
||||||
_service()
|
|
||||||
{
|
|
||||||
local cur prev sysvdir
|
|
||||||
|
|
||||||
COMPREPLY=()
|
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
||||||
cur=`_get_cword`
|
|
||||||
|
|
||||||
# don't complete for things like killall, ssh and mysql if it's
|
|
||||||
# the standalone command, rather than the init script
|
|
||||||
[[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
|
|
||||||
|
|
||||||
# don't complete past 2nd token
|
|
||||||
[ $COMP_CWORD -gt 2 ] && return 0
|
|
||||||
|
|
||||||
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
|
|
||||||
|
|
||||||
if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
|
|
||||||
_services
|
|
||||||
else
|
|
||||||
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
|
|
||||||
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
|
|
||||||
$sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
} &&
|
|
||||||
complete -F _service service
|
|
||||||
[ -d /etc/init.d/ ] && complete -F _service -o default \
|
|
||||||
$(for i in /etc/init.d/*; do printf '%s\n' ${i##*/}; done)
|
|
||||||
|
|
||||||
|
|
||||||
# chown(1) completion
|
|
||||||
#
|
|
||||||
_chown()
|
|
||||||
{
|
|
||||||
local cur prev split=false
|
|
||||||
|
|
||||||
# Get cur and prev words; but don't treat user:group as separate words.
|
|
||||||
cur=`_get_cword :`
|
|
||||||
prev=`_get_pword :`
|
|
||||||
|
|
||||||
_split_longopt && split=true
|
|
||||||
|
|
||||||
case "$prev" in
|
|
||||||
--from)
|
|
||||||
_usergroup
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
--reference)
|
|
||||||
_filedir
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
$split && return 0
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
# Complete -options
|
|
||||||
local w opts
|
|
||||||
for w in "${COMP_WORDS[@]}" ; do
|
|
||||||
[[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break
|
|
||||||
done
|
|
||||||
COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference \
|
|
||||||
--no-dereference --from --silent --quiet --reference --recursive \
|
|
||||||
--verbose --help --version $opts' -- "$cur" ) )
|
|
||||||
else
|
|
||||||
local args
|
|
||||||
|
|
||||||
# The first argument is an usergroup; the rest are filedir.
|
|
||||||
_count_args :
|
|
||||||
|
|
||||||
if [[ $args == 1 ]]; then
|
|
||||||
_usergroup
|
|
||||||
else
|
|
||||||
_filedir
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
} # _chown()
|
|
||||||
complete -F _chown -o filenames chown
|
|
||||||
|
|
||||||
|
|
||||||
# chgrp(1) completion
|
|
||||||
#
|
|
||||||
_chgrp()
|
|
||||||
{
|
|
||||||
local cur prev split=false
|
|
||||||
|
|
||||||
COMPREPLY=()
|
|
||||||
cur=`_get_cword`
|
|
||||||
cur=${cur//\\\\/}
|
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
||||||
|
|
||||||
_split_longopt && split=true
|
|
||||||
|
|
||||||
if [[ "$prev" == --reference ]]; then
|
|
||||||
_filedir
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
$split && return 0
|
|
||||||
|
|
||||||
# options completion
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
local w opts
|
|
||||||
for w in "${COMP_WORDS[@]}" ; do
|
|
||||||
[[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break
|
|
||||||
done
|
|
||||||
COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference \
|
|
||||||
--no-dereference --silent --quiet --reference --recursive \
|
|
||||||
--verbose --help --version $opts' -- "$cur" ) )
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# first parameter on line or first since an option?
|
|
||||||
if [[ $COMP_CWORD -eq 1 && "$cur" != -* || "$prev" == -* ]]; then
|
|
||||||
local IFS=$'\n'
|
|
||||||
COMPREPLY=( $( compgen -g "$cur" 2>/dev/null ) )
|
|
||||||
else
|
|
||||||
_filedir || return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
} # _chgrp()
|
|
||||||
complete -F _chgrp -o filenames chgrp
|
|
||||||
|
|
||||||
|
|
||||||
# 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 &&
|
|
||||||
_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
|
|
||||||
#
|
|
||||||
[ $USERLAND = GNU ] && { have ifup || have ifdown; } &&
|
|
||||||
_ifupdown()
|
|
||||||
{
|
|
||||||
local cur
|
|
||||||
|
|
||||||
COMPREPLY=()
|
|
||||||
cur=`_get_cword`
|
|
||||||
|
|
||||||
if [ $COMP_CWORD -eq 1 ]; then
|
|
||||||
_configured_interfaces
|
|
||||||
COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
} &&
|
|
||||||
complete -F _ifupdown ifup ifdown
|
|
||||||
[ $USERLAND = GNU ] && have ifstatus && complete -F _ifupdown ifstatus
|
|
||||||
|
|
||||||
# Linux ipsec(8) completion (for FreeS/WAN)
|
|
||||||
#
|
|
||||||
[ $UNAME = Linux ] && have ipsec &&
|
|
||||||
_ipsec()
|
|
||||||
{
|
|
||||||
local cur
|
|
||||||
|
|
||||||
COMPREPLY=()
|
|
||||||
cur=`_get_cword`
|
|
||||||
|
|
||||||
|
|
||||||
if [ $COMP_CWORD -eq 1 ]; then
|
|
||||||
COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual \
|
|
||||||
pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp \
|
|
||||||
tncfg whack' -- "$cur" ) )
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
case ${COMP_WORDS[1]} in
|
|
||||||
auto)
|
|
||||||
COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
|
|
||||||
--replace --down --route --unroute \
|
|
||||||
--ready --status --rereadsecrets' \
|
|
||||||
-- "$cur" ) )
|
|
||||||
;;
|
|
||||||
manual)
|
|
||||||
COMPREPLY=( $( compgen -W '--up --down --route --unroute \
|
|
||||||
--union' -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
ranbits)
|
|
||||||
COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
|
|
||||||
-- "$cur" ) )
|
|
||||||
;;
|
|
||||||
setup)
|
|
||||||
COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
return 0
|
|
||||||
} &&
|
|
||||||
complete -F _ipsec ipsec
|
|
||||||
|
|
||||||
# This function provides simple user@host completion
|
# This function provides simple user@host completion
|
||||||
#
|
#
|
||||||
_user_at_host() {
|
_user_at_host() {
|
||||||
@ -1779,41 +1493,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
|
|
||||||
|
|
||||||
# id(1) completion
|
|
||||||
#
|
|
||||||
have id &&
|
|
||||||
_id()
|
|
||||||
{
|
|
||||||
local cur
|
|
||||||
|
|
||||||
COMPREPLY=()
|
|
||||||
cur=`_get_cword`
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
|
|
||||||
-r --real -u --user --help --version' -- "$cur" ) )
|
|
||||||
else
|
|
||||||
COMPREPLY=( $( compgen -u "$cur" ) )
|
|
||||||
fi
|
|
||||||
} &&
|
|
||||||
complete -F _id id
|
|
||||||
|
|
||||||
_filedir_xspec()
|
_filedir_xspec()
|
||||||
{
|
{
|
||||||
local IFS cur xspec
|
local IFS cur xspec
|
||||||
|
124
contrib/coreutils
Normal file
124
contrib/coreutils
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
# Completions for various core utilities
|
||||||
|
|
||||||
|
# chown(1) completion
|
||||||
|
#
|
||||||
|
have chown &&
|
||||||
|
_chown()
|
||||||
|
{
|
||||||
|
local cur prev split=false
|
||||||
|
|
||||||
|
# Get cur and prev words; but don't treat user:group as separate words.
|
||||||
|
cur=`_get_cword :`
|
||||||
|
prev=`_get_pword :`
|
||||||
|
|
||||||
|
_split_longopt && split=true
|
||||||
|
|
||||||
|
case "$prev" in
|
||||||
|
--from)
|
||||||
|
_usergroup
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--reference)
|
||||||
|
_filedir
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
$split && return 0
|
||||||
|
|
||||||
|
if [[ "$cur" == -* ]]; then
|
||||||
|
# Complete -options
|
||||||
|
local w opts
|
||||||
|
for w in "${COMP_WORDS[@]}" ; do
|
||||||
|
[[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break
|
||||||
|
done
|
||||||
|
COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference \
|
||||||
|
--no-dereference --from --silent --quiet --reference --recursive \
|
||||||
|
--verbose --help --version $opts' -- "$cur" ) )
|
||||||
|
else
|
||||||
|
local args
|
||||||
|
|
||||||
|
# The first argument is an usergroup; the rest are filedir.
|
||||||
|
_count_args :
|
||||||
|
|
||||||
|
if [[ $args == 1 ]]; then
|
||||||
|
_usergroup
|
||||||
|
else
|
||||||
|
_filedir
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
} &&
|
||||||
|
complete -F _chown -o filenames chown
|
||||||
|
|
||||||
|
|
||||||
|
# chgrp(1) completion
|
||||||
|
#
|
||||||
|
have chgrp &&
|
||||||
|
_chgrp()
|
||||||
|
{
|
||||||
|
local cur prev split=false
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
cur=`_get_cword`
|
||||||
|
cur=${cur//\\\\/}
|
||||||
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
|
||||||
|
_split_longopt && split=true
|
||||||
|
|
||||||
|
if [[ "$prev" == --reference ]]; then
|
||||||
|
_filedir
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
$split && return 0
|
||||||
|
|
||||||
|
# options completion
|
||||||
|
if [[ "$cur" == -* ]]; then
|
||||||
|
local w opts
|
||||||
|
for w in "${COMP_WORDS[@]}" ; do
|
||||||
|
[[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break
|
||||||
|
done
|
||||||
|
COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference \
|
||||||
|
--no-dereference --silent --quiet --reference --recursive \
|
||||||
|
--verbose --help --version $opts' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# first parameter on line or first since an option?
|
||||||
|
if [[ $COMP_CWORD -eq 1 && "$cur" != -* || "$prev" == -* ]]; then
|
||||||
|
local IFS=$'\n'
|
||||||
|
COMPREPLY=( $( compgen -g "$cur" 2>/dev/null ) )
|
||||||
|
else
|
||||||
|
_filedir || return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
} &&
|
||||||
|
complete -F _chgrp -o filenames chgrp
|
||||||
|
|
||||||
|
# id(1) completion
|
||||||
|
#
|
||||||
|
have id &&
|
||||||
|
_id()
|
||||||
|
{
|
||||||
|
local cur
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
cur=`_get_cword`
|
||||||
|
|
||||||
|
if [[ "$cur" == -* ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
|
||||||
|
-r --real -u --user --help --version' -- "$cur" ) )
|
||||||
|
else
|
||||||
|
COMPREPLY=( $( compgen -u "$cur" ) )
|
||||||
|
fi
|
||||||
|
} &&
|
||||||
|
complete -F _id id
|
||||||
|
|
||||||
|
# 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
|
27
contrib/ifupdown
Normal file
27
contrib/ifupdown
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Red Hat & Debian GNU/Linux if{up,down} completion
|
||||||
|
#
|
||||||
|
[ $USERLAND = GNU ] && { have ifup || have ifdown; } &&
|
||||||
|
_ifupdown()
|
||||||
|
{
|
||||||
|
local cur
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
cur=`_get_cword`
|
||||||
|
|
||||||
|
if [ $COMP_CWORD -eq 1 ]; then
|
||||||
|
_configured_interfaces
|
||||||
|
COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
} &&
|
||||||
|
complete -F _ifupdown ifup ifdown
|
||||||
|
[ $USERLAND = GNU ] && have ifstatus && complete -F _ifupdown ifstatus
|
||||||
|
|
||||||
|
# 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
|
51
contrib/ipsec
Normal file
51
contrib/ipsec
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# Linux ipsec(8) completion (for FreeS/WAN)
|
||||||
|
#
|
||||||
|
[ $UNAME = Linux ] && have ipsec &&
|
||||||
|
_ipsec()
|
||||||
|
{
|
||||||
|
local cur
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
cur=`_get_cword`
|
||||||
|
|
||||||
|
|
||||||
|
if [ $COMP_CWORD -eq 1 ]; then
|
||||||
|
COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual \
|
||||||
|
pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp \
|
||||||
|
tncfg whack' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
case ${COMP_WORDS[1]} in
|
||||||
|
auto)
|
||||||
|
COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
|
||||||
|
--replace --down --route --unroute \
|
||||||
|
--ready --status --rereadsecrets' \
|
||||||
|
-- "$cur" ) )
|
||||||
|
;;
|
||||||
|
manual)
|
||||||
|
COMPREPLY=( $( compgen -W '--up --down --route --unroute \
|
||||||
|
--union' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
ranbits)
|
||||||
|
COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
|
||||||
|
-- "$cur" ) )
|
||||||
|
;;
|
||||||
|
setup)
|
||||||
|
COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
} &&
|
||||||
|
complete -F _ipsec ipsec
|
||||||
|
|
||||||
|
# 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
|
49
contrib/procps
Normal file
49
contrib/procps
Normal 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
|
46
contrib/service
Normal file
46
contrib/service
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# service(8) and /etc/init.d/* completion
|
||||||
|
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
{ have service || [ -d /etc/init.d/ ]; } &&
|
||||||
|
_service()
|
||||||
|
{
|
||||||
|
local cur prev sysvdir
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
cur=`_get_cword`
|
||||||
|
|
||||||
|
# don't complete for things like killall, ssh and mysql if it's
|
||||||
|
# the standalone command, rather than the init script
|
||||||
|
[[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
|
||||||
|
|
||||||
|
# don't complete past 2nd token
|
||||||
|
[ $COMP_CWORD -gt 2 ] && return 0
|
||||||
|
|
||||||
|
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
|
||||||
|
|
||||||
|
if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
|
||||||
|
_services
|
||||||
|
else
|
||||||
|
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
|
||||||
|
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
|
||||||
|
$sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
} &&
|
||||||
|
complete -F _service service
|
||||||
|
[ -d /etc/init.d/ ] && complete -F _service -o default \
|
||||||
|
$(for i in /etc/init.d/*; do
|
||||||
|
complete -p ${i##*/} &>/dev/null || printf '%s\n' ${i##*/}; done)
|
||||||
|
|
||||||
|
# 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
|
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
|
1
test/completion/chgrp.exp
Normal file
1
test/completion/chgrp.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
assert_source_completions chgrp
|
1
test/completion/ipsec.exp
Normal file
1
test/completion/ipsec.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
assert_source_completions ipsec
|
1
test/completion/pgrep.exp
Normal file
1
test/completion/pgrep.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
assert_source_completions pgrep
|
1
test/completion/pkill.exp
Normal file
1
test/completion/pkill.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
assert_source_completions pkill
|
20
test/lib/completions/chgrp.exp
Normal file
20
test/lib/completions/chgrp.exp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
proc setup {} {
|
||||||
|
save_env
|
||||||
|
}; # setup()
|
||||||
|
|
||||||
|
|
||||||
|
proc teardown {} {
|
||||||
|
assert_env_unmodified
|
||||||
|
}; # teardown()
|
||||||
|
|
||||||
|
|
||||||
|
setup
|
||||||
|
|
||||||
|
|
||||||
|
assert_complete_any "chgrp "
|
||||||
|
|
||||||
|
|
||||||
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
|
teardown
|
20
test/lib/completions/ipsec.exp
Normal file
20
test/lib/completions/ipsec.exp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
proc setup {} {
|
||||||
|
save_env
|
||||||
|
}; # setup()
|
||||||
|
|
||||||
|
|
||||||
|
proc teardown {} {
|
||||||
|
assert_env_unmodified
|
||||||
|
}; # teardown()
|
||||||
|
|
||||||
|
|
||||||
|
setup
|
||||||
|
|
||||||
|
|
||||||
|
assert_complete_any "ipsec "
|
||||||
|
|
||||||
|
|
||||||
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
|
teardown
|
20
test/lib/completions/pgrep.exp
Normal file
20
test/lib/completions/pgrep.exp
Normal 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
|
20
test/lib/completions/pkill.exp
Normal file
20
test/lib/completions/pkill.exp
Normal 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
|
Loading…
x
Reference in New Issue
Block a user