This commit is contained in:
Freddy Vulto 2009-10-18 12:38:04 +02:00
parent ffe704c24b
commit 0dda212d95

View File

@ -402,22 +402,23 @@ _filedir()
while read -r tmp; do
echo $tmp
done
}
))
}
))
if [[ "$1" != -d ]]; then
if [[ "$1" != -d ]]; then
xspec=${1:+"!*.$1"}
toks=( ${toks[@]-} $(
compgen -f -X "$xspec" -- "$(quote_readline "$cur")" | {
while read -r tmp; do
[ -n $tmp ] && echo $tmp
done
}
))
}
))
fi
COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
}
} # _filedir()
# This function splits $cur=--foo=bar into $prev=--foo, $cur=bar, making it
# easier to support both "--foo bar" and "--foo=bar" style completions.
@ -691,7 +692,7 @@ _realcommand() {
else
type -P "$1"
fi
}
}
}
@ -735,8 +736,8 @@ deinstall clean clean-depends kernel buildworld' make
# that script's available commands
#
{ have service || [ -d /etc/init.d/ ]; } &&
_service()
{
_service()
{
local cur prev sysvdir
COMPREPLY=()
@ -762,15 +763,16 @@ deinstall clean clean-depends kernel buildworld' make
fi
return 0
} &&
complete -F _service service
[ -d /etc/init.d/ ] && complete -F _service $default \
$(for i in /etc/init.d/*; do echo ${i##*/}; done)
} &&
complete -F _service service
[ -d /etc/init.d/ ] && complete -F _service $default \
$(for i in /etc/init.d/*; do echo ${i##*/}; done)
# chown(1) completion
#
_chown()
{
# chown(1) completion
#
_chown()
{
local cur prev split=false
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
@ -807,13 +809,14 @@ deinstall clean clean-depends kernel buildworld' make
;;
esac
fi
}
complete -F _chown $filenames chown
} # _chown()
complete -F _chown $filenames chown
# chgrp(1) completion
#
_chgrp()
{
# chgrp(1) completion
#
_chgrp()
{
local cur prev split=false
COMPREPLY=()
@ -848,14 +851,15 @@ deinstall clean clean-depends kernel buildworld' make
fi
return 0
}
complete -F _chgrp $filenames chgrp
} # _chgrp()
complete -F _chgrp $filenames chgrp
# umount(8) completion. This relies on the mount point being the third
# space-delimited field in the output of mount(8)
#
_umount()
{
# umount(8) completion. This relies on the mount point being the third
# space-delimited field in the output of mount(8)
#
_umount()
{
local cur IFS=$'\n'
COMPREPLY=()
@ -864,17 +868,18 @@ deinstall clean clean-depends kernel buildworld' make
COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) )
return 0
}
complete -F _umount $dirnames umount
}
complete -F _umount $dirnames umount
# mount(8) completion. This will pull a list of possible mounts out of
# /etc/{,v}fstab, unless the word being completed contains a ':', which
# would indicate the specification of an NFS server. In that case, we
# query the server for a list of all available exports and complete on
# that instead.
#
_mount()
{
# mount(8) completion. This will pull a list of possible mounts out of
# /etc/{,v}fstab, unless the word being completed contains a ':', which
# would indicate the specification of an NFS server. In that case, we
# query the server for a list of all available exports and complete on
# that instead.
#
_mount()
{
local cur i sm host prev
COMPREPLY=()
@ -913,15 +918,16 @@ deinstall clean clean-depends kernel buildworld' make
fi
return 0
}
complete -F _mount $default $dirnames mount
} # _mount()
complete -F _mount $default $dirnames mount
# Linux rmmod(8) completion. This completes on a list of all currently
# installed kernel modules.
#
have rmmod && {
_rmmod()
{
# Linux rmmod(8) completion. This completes on a list of all currently
# installed kernel modules.
#
have rmmod && {
_rmmod()
{
local cur
COMPREPLY=()
@ -929,15 +935,16 @@ deinstall clean clean-depends kernel buildworld' make
_installed_modules "$cur"
return 0
}
complete -F _rmmod rmmod
} # _rmmod()
complete -F _rmmod rmmod
# Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a
# list of all available modules for the version of the kernel currently
# running.
#
_insmod()
{
# Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a
# list of all available modules for the version of the kernel currently
# running.
#
_insmod()
{
local cur prev modpath
COMPREPLY=()
@ -968,9 +975,10 @@ deinstall clean clean-depends kernel buildworld' make
fi
return 0
}
complete -F _insmod $filenames insmod modprobe modinfo
}
} # _insmod
complete -F _insmod $filenames insmod modprobe modinfo
} # have rmmod
# renice(8) completion
#
@ -1002,6 +1010,7 @@ _renice()
}
complete -F _renice renice
# kill(1) completion
#
_kill()
@ -1156,7 +1165,7 @@ _known_hosts()
[ "$1" = -a ] || [ "$2" = -a ] && options=-a
[ "$1" = -c ] || [ "$2" = -c ] && options="$options -c"
_known_hosts_real $options "$(_get_cword)"
}
} # _known_hosts()
# Helper function for completing _known_hosts.
# This function performs host completion based on ssh's known_hosts files.
@ -1324,7 +1333,7 @@ _known_hosts_real()
fi
return 0
}
} # _known_hosts_real()
complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
ping ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr