Merge branch 'master' into 1.x
This commit is contained in:
commit
a0bb238dc8
6
CHANGES
6
CHANGES
@ -14,9 +14,9 @@ bash-completion (1.3)
|
||||
[ Ville Skyttä ]
|
||||
* Activate hping2 completion also for hping and hping3.
|
||||
* Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake,
|
||||
filefrag, growisofs, iftop, ip (Debian: #600617), lrzip, lsof, mktemp,
|
||||
portecle, POSIX sh, sha{,224,256,384,512}sum, sysbench, tune2fs, xmodmap,
|
||||
and xrdb completions.
|
||||
filefrag, gendiff, growisofs, iftop, ip (Debian: #600617), javaws, kid3,
|
||||
lrzip, lsof, mktemp, portecle, POSIX sh, sha{,224,256,384,512}sum,
|
||||
sysbench, tune2fs, xmodmap, and xrdb completions.
|
||||
* Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2,
|
||||
*.awb, and *.iso (Alioth: #311420) to mplayer filename completions.
|
||||
* Add "short" tarball extensions to unxz, unlzma etc completions.
|
||||
|
@ -123,6 +123,7 @@ complete -f -X '!*.ly' lilypond ly2dvi
|
||||
complete -f -X '!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))' cdiff
|
||||
complete -f -X '!*.lyx' lyx
|
||||
complete -f -X '!@(*.@(ks|jks|jceks|p12|pfx|bks|ubr|gkr|cer|crt|cert|p7b|pkipath|pem|p10|csr|crl)|cacerts)' portecle
|
||||
complete -f -X '!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)' kid3 kid3-qt
|
||||
# FINISH exclude -- do not remove this line
|
||||
|
||||
# start of section containing compspecs that can be handled within bash
|
||||
@ -687,7 +688,7 @@ _split_longopt()
|
||||
#
|
||||
_parse_help() {
|
||||
$1 ${2:---help} 2>&1 | sed -e '/^[[:space:]]*-/!d' -e 's|[,/]| |g' | \
|
||||
awk '{ print $1; if ($2 ~ /^-/) { print $2 } }' | sed -e 's|=.*||'
|
||||
awk '{ print $1; if ($2 ~ /^-/) { print $2 } }' | sed -e 's|[<=].*||'
|
||||
}
|
||||
|
||||
# This function completes on signal names
|
||||
@ -1244,12 +1245,10 @@ _known_hosts_real()
|
||||
[ -r "$configfile" ] &&
|
||||
config=( "${config[@]}" "$configfile" )
|
||||
else
|
||||
[ -r /etc/ssh/ssh_config ] &&
|
||||
config=( "${config[@]}" "/etc/ssh/ssh_config" )
|
||||
[ -r "${HOME}/.ssh/config" ] &&
|
||||
config=( "${config[@]}" "${HOME}/.ssh/config" )
|
||||
[ -r "${HOME}/.ssh2/config" ] &&
|
||||
config=( "${config[@]}" "${HOME}/.ssh2/config" )
|
||||
for i in /etc/ssh/ssh_config "${HOME}/.ssh/config" \
|
||||
"${HOME}/.ssh2/config"; do
|
||||
[ -r $i ] && config=( "${config[@]}" "$i" )
|
||||
done
|
||||
fi
|
||||
|
||||
# Known hosts files from configs
|
||||
@ -1271,28 +1270,16 @@ _known_hosts_real()
|
||||
IFS=$OIFS
|
||||
fi
|
||||
|
||||
# Global known_hosts files
|
||||
if [ -z "$configfile" ]; then
|
||||
[ -r /etc/ssh/ssh_known_hosts ] &&
|
||||
kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts )
|
||||
[ -r /etc/ssh/ssh_known_hosts2 ] &&
|
||||
kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 )
|
||||
[ -r /etc/known_hosts ] &&
|
||||
kh=( "${kh[@]}" /etc/known_hosts )
|
||||
[ -r /etc/known_hosts2 ] &&
|
||||
kh=( "${kh[@]}" /etc/known_hosts2 )
|
||||
[ -d /etc/ssh2/knownhosts ] &&
|
||||
khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub )
|
||||
fi
|
||||
|
||||
# User known_hosts files
|
||||
if [ -z "$configfile" ]; then
|
||||
[ -r ~/.ssh/known_hosts ] &&
|
||||
kh=( "${kh[@]}" ~/.ssh/known_hosts )
|
||||
[ -r ~/.ssh/known_hosts2 ] &&
|
||||
kh=( "${kh[@]}" ~/.ssh/known_hosts2 )
|
||||
[ -d ~/.ssh2/hostkeys ] &&
|
||||
khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub )
|
||||
# Global and user known_hosts files
|
||||
for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \
|
||||
/etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \
|
||||
~/.ssh/known_hosts2; do
|
||||
[ -r $i ] && kh=( "${kh[@]}" $i )
|
||||
done
|
||||
for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do
|
||||
[ -d $i ] && khd=( "${khd[@]}" $i/*pub )
|
||||
done
|
||||
fi
|
||||
|
||||
# If we have known_hosts files to use
|
||||
|
@ -1,13 +1,14 @@
|
||||
# bash completion for java, javac and javadoc
|
||||
|
||||
# available path elements completion
|
||||
have java && {
|
||||
have java || have javac || have javadoc &&
|
||||
_java_path()
|
||||
{
|
||||
cur=${cur##*:}
|
||||
_filedir '@(jar|zip)'
|
||||
}
|
||||
|
||||
have java || have javadoc && {
|
||||
# exact classpath determination
|
||||
_java_find_classpath()
|
||||
{
|
||||
@ -60,7 +61,7 @@ _java_classes()
|
||||
cur=${cur//.//}
|
||||
# parse each classpath element for classes
|
||||
for i in ${classpath//:/ }; do
|
||||
if [[ -r $i && "$i" == *.@(jar|zip) ]]; then
|
||||
if [[ "$i" == *.@(jar|zip) && -r $i ]]; then
|
||||
if type zipinfo &>/dev/null; then
|
||||
COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
|
||||
"$i" "$cur*" 2>/dev/null | \
|
||||
@ -113,9 +114,11 @@ _java_packages()
|
||||
# convert path syntax to package syntax
|
||||
cur=${COMPREPLY[@]//\//.}
|
||||
}
|
||||
}
|
||||
|
||||
# java completion
|
||||
#
|
||||
have java &&
|
||||
_java()
|
||||
{
|
||||
local cur prev words cword i
|
||||
@ -230,9 +233,8 @@ _java()
|
||||
type compopt &>/dev/null && compopt -o nospace
|
||||
|
||||
__ltrim_colon_completions "$cur"
|
||||
}
|
||||
} &&
|
||||
complete -F _java java
|
||||
}
|
||||
|
||||
have javadoc &&
|
||||
_javadoc()
|
||||
@ -492,6 +494,36 @@ _jarsigner()
|
||||
} &&
|
||||
complete -F _jarsigner jarsigner
|
||||
|
||||
have javaws &&
|
||||
_javaws()
|
||||
{
|
||||
COMPREPLY=()
|
||||
local cur prev
|
||||
_get_comp_words_by_ref cur prev
|
||||
|
||||
case $prev in
|
||||
-help|-license|-about|-viewer|-arg|-param|-property|-update|-umask)
|
||||
return 0
|
||||
;;
|
||||
-basedir|-codebase)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
-uninstall|-import)
|
||||
_filedir jnlp
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W "$( _parse_help "$1" -help ) " -- "$cur" ) )
|
||||
return 0
|
||||
fi
|
||||
|
||||
_filedir jnlp
|
||||
} &&
|
||||
complete -F _javaws javaws
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# sh-basic-offset: 4
|
||||
|
@ -37,8 +37,11 @@ _muttrc()
|
||||
done
|
||||
|
||||
if [ -z "$muttrc" ]; then
|
||||
[ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
|
||||
[ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
|
||||
if [ -f ~/.${muttcmd}rc ]; then
|
||||
muttrc="~/.${muttcmd}rc"
|
||||
elif [ -f ~/.${muttcmd}/${muttcmd}rc ]; then
|
||||
muttrc="~/.${muttcmd}/${muttcmd}rc"
|
||||
fi
|
||||
fi
|
||||
printf "%s" "$muttrc"
|
||||
} # _muttrc()
|
||||
|
@ -290,6 +290,16 @@ _rpm()
|
||||
complete -F _rpm rpm rpmbuild
|
||||
}
|
||||
|
||||
have gendiff &&
|
||||
_gendiff()
|
||||
{
|
||||
COMPREPLY=()
|
||||
local cur cword
|
||||
_get_comp_words_by_ref cur cword
|
||||
[[ $cword != 1 ]] || _filedir -d
|
||||
} &&
|
||||
complete -F _gendiff gendiff
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# sh-basic-offset: 4
|
||||
|
@ -19,11 +19,11 @@ _service()
|
||||
# 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
|
||||
[ -d /etc/rc.d/init.d ] && \
|
||||
sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
|
||||
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
|
||||
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
|
||||
$sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )
|
||||
|
1
test/completion/javaws.exp
Normal file
1
test/completion/javaws.exp
Normal file
@ -0,0 +1 @@
|
||||
assert_source_completions javaws
|
20
test/lib/completions/javaws.exp
Normal file
20
test/lib/completions/javaws.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "javaws "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
@ -13,12 +13,7 @@ setup
|
||||
|
||||
|
||||
set test "Tab should complete hostnames"
|
||||
# Build string list of hostnames
|
||||
set hosts {}
|
||||
foreach h [exec bash -c "compgen -A hostname"] {
|
||||
lappend hosts $h
|
||||
}
|
||||
assert_complete $hosts "xhost " $test
|
||||
assert_complete [get_hosts] "xhost " $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -28,7 +23,7 @@ set test "Tab should complete partial hostname"
|
||||
# Build string list of hostnames, starting with the character of the first hostname
|
||||
set hosts {}
|
||||
set char ""
|
||||
foreach h [exec bash -c "compgen -A hostname"] {
|
||||
foreach h [get_hosts] {
|
||||
if {$char == ""} {set char [string range $h 0 0]}
|
||||
# Only append hostname if starting with $char
|
||||
if {[string range $h 0 0] == "$char"} {
|
||||
@ -44,7 +39,7 @@ sync_after_int
|
||||
set test "Tab should complete hostnames prefixed with +"
|
||||
# Build string list of hostnames, prefixed with plus (+)
|
||||
set hosts {}
|
||||
foreach h [exec bash -c "compgen -A hostname"] {
|
||||
foreach h [get_hosts] {
|
||||
lappend hosts "+$h"
|
||||
}
|
||||
assert_complete $hosts "xhost \+" $test
|
||||
@ -56,7 +51,7 @@ sync_after_int
|
||||
set test "Tab should complete partial hostname prefixed with +"
|
||||
# Build string list of hostnames, starting with character of first host.
|
||||
set hosts {}
|
||||
foreach h [exec bash -c "compgen -A hostname"] {
|
||||
foreach h [get_hosts] {
|
||||
if {$char == ""} {set char [string range $h 0 0]}
|
||||
# Only append hostname if starting with $char
|
||||
if {[string range $h 0 0] == "$char"} {
|
||||
@ -72,7 +67,7 @@ sync_after_int
|
||||
set test "Tab should complete hostnames prefixed with -"
|
||||
# Build string list of hostnames, prefix with minus (-)
|
||||
set hosts {}
|
||||
foreach h [exec bash -c "compgen -A hostname"] {
|
||||
foreach h [get_hosts] {
|
||||
lappend hosts "-$h"
|
||||
}
|
||||
assert_complete $hosts "xhost -" $test
|
||||
@ -84,7 +79,7 @@ sync_after_int
|
||||
set test "Tab should complete partial hostname prefixed with -"
|
||||
# Build list of hostnames, starting with character of first host
|
||||
set hosts {}
|
||||
foreach h [exec bash -c "compgen -A hostname"] {
|
||||
foreach h [get_hosts] {
|
||||
if {$char == ""} {set char [string range $h 0 0]}
|
||||
# Only append hostname if starting with $char
|
||||
if {[string range $h 0 0] == "$char"} {
|
||||
|
@ -636,7 +636,7 @@ proc get_known_hosts {{cword ''}} {
|
||||
# @return list Hostnames
|
||||
# @see get_known_hosts()
|
||||
proc get_hosts {} {
|
||||
set hosts [exec bash -c "compgen -A hostname"]
|
||||
set hosts [exec bash -c "compgen -A hostname | sort -u"]
|
||||
# NOTE: Circumventing var `avahi_hosts' and appending directly to `hosts'
|
||||
# causes an empty element to be inserted in `hosts'.
|
||||
# -- FVu, Fri Jul 17 23:11:46 CEST 2009
|
||||
|
Loading…
x
Reference in New Issue
Block a user