Merge branch 'master' into 1.x

This commit is contained in:
David Paleino 2011-02-06 17:50:38 +01:00
commit a0bb238dc8
10 changed files with 99 additions and 51 deletions

View File

@ -14,9 +14,9 @@ bash-completion (1.3)
[ Ville Skyttä ] [ Ville Skyttä ]
* Activate hping2 completion also for hping and hping3. * Activate hping2 completion also for hping and hping3.
* Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake, * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake,
filefrag, growisofs, iftop, ip (Debian: #600617), lrzip, lsof, mktemp, filefrag, gendiff, growisofs, iftop, ip (Debian: #600617), javaws, kid3,
portecle, POSIX sh, sha{,224,256,384,512}sum, sysbench, tune2fs, xmodmap, lrzip, lsof, mktemp, portecle, POSIX sh, sha{,224,256,384,512}sum,
and xrdb completions. sysbench, tune2fs, xmodmap, and xrdb completions.
* Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2, * Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2,
*.awb, and *.iso (Alioth: #311420) to mplayer filename completions. *.awb, and *.iso (Alioth: #311420) to mplayer filename completions.
* Add "short" tarball extensions to unxz, unlzma etc completions. * Add "short" tarball extensions to unxz, unlzma etc completions.

View File

@ -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 '!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))' cdiff
complete -f -X '!*.lyx' lyx 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 '!@(*.@(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 # FINISH exclude -- do not remove this line
# start of section containing compspecs that can be handled within bash # start of section containing compspecs that can be handled within bash
@ -687,7 +688,7 @@ _split_longopt()
# #
_parse_help() { _parse_help() {
$1 ${2:---help} 2>&1 | sed -e '/^[[:space:]]*-/!d' -e 's|[,/]| |g' | \ $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 # This function completes on signal names
@ -1244,12 +1245,10 @@ _known_hosts_real()
[ -r "$configfile" ] && [ -r "$configfile" ] &&
config=( "${config[@]}" "$configfile" ) config=( "${config[@]}" "$configfile" )
else else
[ -r /etc/ssh/ssh_config ] && for i in /etc/ssh/ssh_config "${HOME}/.ssh/config" \
config=( "${config[@]}" "/etc/ssh/ssh_config" ) "${HOME}/.ssh2/config"; do
[ -r "${HOME}/.ssh/config" ] && [ -r $i ] && config=( "${config[@]}" "$i" )
config=( "${config[@]}" "${HOME}/.ssh/config" ) done
[ -r "${HOME}/.ssh2/config" ] &&
config=( "${config[@]}" "${HOME}/.ssh2/config" )
fi fi
# Known hosts files from configs # Known hosts files from configs
@ -1271,28 +1270,16 @@ _known_hosts_real()
IFS=$OIFS IFS=$OIFS
fi fi
# Global known_hosts files
if [ -z "$configfile" ]; then if [ -z "$configfile" ]; then
[ -r /etc/ssh/ssh_known_hosts ] && # Global and user known_hosts files
kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts ) for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \
[ -r /etc/ssh/ssh_known_hosts2 ] && /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \
kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 ) ~/.ssh/known_hosts2; do
[ -r /etc/known_hosts ] && [ -r $i ] && kh=( "${kh[@]}" $i )
kh=( "${kh[@]}" /etc/known_hosts ) done
[ -r /etc/known_hosts2 ] && for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do
kh=( "${kh[@]}" /etc/known_hosts2 ) [ -d $i ] && khd=( "${khd[@]}" $i/*pub )
[ -d /etc/ssh2/knownhosts ] && done
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 )
fi fi
# If we have known_hosts files to use # If we have known_hosts files to use

View File

@ -1,13 +1,14 @@
# bash completion for java, javac and javadoc # bash completion for java, javac and javadoc
# available path elements completion # available path elements completion
have java && { have java || have javac || have javadoc &&
_java_path() _java_path()
{ {
cur=${cur##*:} cur=${cur##*:}
_filedir '@(jar|zip)' _filedir '@(jar|zip)'
} }
have java || have javadoc && {
# exact classpath determination # exact classpath determination
_java_find_classpath() _java_find_classpath()
{ {
@ -60,7 +61,7 @@ _java_classes()
cur=${cur//.//} cur=${cur//.//}
# parse each classpath element for classes # parse each classpath element for classes
for i in ${classpath//:/ }; do 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 if type zipinfo &>/dev/null; then
COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \ COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
"$i" "$cur*" 2>/dev/null | \ "$i" "$cur*" 2>/dev/null | \
@ -113,9 +114,11 @@ _java_packages()
# convert path syntax to package syntax # convert path syntax to package syntax
cur=${COMPREPLY[@]//\//.} cur=${COMPREPLY[@]//\//.}
} }
}
# java completion # java completion
# #
have java &&
_java() _java()
{ {
local cur prev words cword i local cur prev words cword i
@ -230,9 +233,8 @@ _java()
type compopt &>/dev/null && compopt -o nospace type compopt &>/dev/null && compopt -o nospace
__ltrim_colon_completions "$cur" __ltrim_colon_completions "$cur"
} } &&
complete -F _java java complete -F _java java
}
have javadoc && have javadoc &&
_javadoc() _javadoc()
@ -492,6 +494,36 @@ _jarsigner()
} && } &&
complete -F _jarsigner 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: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 4 # sh-basic-offset: 4

View File

@ -37,8 +37,11 @@ _muttrc()
done done
if [ -z "$muttrc" ]; then if [ -z "$muttrc" ]; then
[ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc" if [ -f ~/.${muttcmd}rc ]; then
[ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc" muttrc="~/.${muttcmd}rc"
elif [ -f ~/.${muttcmd}/${muttcmd}rc ]; then
muttrc="~/.${muttcmd}/${muttcmd}rc"
fi
fi fi
printf "%s" "$muttrc" printf "%s" "$muttrc"
} # _muttrc() } # _muttrc()

View File

@ -290,6 +290,16 @@ _rpm()
complete -F _rpm rpm rpmbuild 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: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 4 # sh-basic-offset: 4

View File

@ -19,11 +19,11 @@ _service()
# don't complete past 2nd token # don't complete past 2nd token
[ $COMP_CWORD -gt 2 ] && return 0 [ $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 if [[ $COMP_CWORD -eq 1 && $prev == "service" ]]; then
_services _services
else else
[ -d /etc/rc.d/init.d ] && \
sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \ COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \ -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
$sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) ) $sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )

View File

@ -0,0 +1 @@
assert_source_completions javaws

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "javaws "
sync_after_int
teardown

View File

@ -13,12 +13,7 @@ setup
set test "Tab should complete hostnames" set test "Tab should complete hostnames"
# Build string list of hostnames assert_complete [get_hosts] "xhost " $test
set hosts {}
foreach h [exec bash -c "compgen -A hostname"] {
lappend hosts $h
}
assert_complete $hosts "xhost " $test
sync_after_int 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 # Build string list of hostnames, starting with the character of the first hostname
set hosts {} set hosts {}
set char "" set char ""
foreach h [exec bash -c "compgen -A hostname"] { foreach h [get_hosts] {
if {$char == ""} {set char [string range $h 0 0]} if {$char == ""} {set char [string range $h 0 0]}
# Only append hostname if starting with $char # Only append hostname if starting with $char
if {[string range $h 0 0] == "$char"} { if {[string range $h 0 0] == "$char"} {
@ -44,7 +39,7 @@ sync_after_int
set test "Tab should complete hostnames prefixed with +" set test "Tab should complete hostnames prefixed with +"
# Build string list of hostnames, prefixed with plus (+) # Build string list of hostnames, prefixed with plus (+)
set hosts {} set hosts {}
foreach h [exec bash -c "compgen -A hostname"] { foreach h [get_hosts] {
lappend hosts "+$h" lappend hosts "+$h"
} }
assert_complete $hosts "xhost \+" $test assert_complete $hosts "xhost \+" $test
@ -56,7 +51,7 @@ sync_after_int
set test "Tab should complete partial hostname prefixed with +" set test "Tab should complete partial hostname prefixed with +"
# Build string list of hostnames, starting with character of first host. # Build string list of hostnames, starting with character of first host.
set hosts {} set hosts {}
foreach h [exec bash -c "compgen -A hostname"] { foreach h [get_hosts] {
if {$char == ""} {set char [string range $h 0 0]} if {$char == ""} {set char [string range $h 0 0]}
# Only append hostname if starting with $char # Only append hostname if starting with $char
if {[string range $h 0 0] == "$char"} { if {[string range $h 0 0] == "$char"} {
@ -72,7 +67,7 @@ sync_after_int
set test "Tab should complete hostnames prefixed with -" set test "Tab should complete hostnames prefixed with -"
# Build string list of hostnames, prefix with minus (-) # Build string list of hostnames, prefix with minus (-)
set hosts {} set hosts {}
foreach h [exec bash -c "compgen -A hostname"] { foreach h [get_hosts] {
lappend hosts "-$h" lappend hosts "-$h"
} }
assert_complete $hosts "xhost -" $test assert_complete $hosts "xhost -" $test
@ -84,7 +79,7 @@ sync_after_int
set test "Tab should complete partial hostname prefixed with -" set test "Tab should complete partial hostname prefixed with -"
# Build list of hostnames, starting with character of first host # Build list of hostnames, starting with character of first host
set hosts {} set hosts {}
foreach h [exec bash -c "compgen -A hostname"] { foreach h [get_hosts] {
if {$char == ""} {set char [string range $h 0 0]} if {$char == ""} {set char [string range $h 0 0]}
# Only append hostname if starting with $char # Only append hostname if starting with $char
if {[string range $h 0 0] == "$char"} { if {[string range $h 0 0] == "$char"} {

View File

@ -636,7 +636,7 @@ proc get_known_hosts {{cword ''}} {
# @return list Hostnames # @return list Hostnames
# @see get_known_hosts() # @see get_known_hosts()
proc get_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' # NOTE: Circumventing var `avahi_hosts' and appending directly to `hosts'
# causes an empty element to be inserted in `hosts'. # causes an empty element to be inserted in `hosts'.
# -- FVu, Fri Jul 17 23:11:46 CEST 2009 # -- FVu, Fri Jul 17 23:11:46 CEST 2009