- patch from Oliver Kiddle to make bash-completion compatible with the
new bash completion emulation feature of zsh
This commit is contained in:
parent
8edd6387c4
commit
31abc9c89e
@ -1,6 +1,6 @@
|
||||
# bash_completion - some programmable completion functions for bash 2.05b
|
||||
#
|
||||
# $Id: bash_completion,v 1.532 2003/02/18 21:35:56 ianmacd Exp $
|
||||
# $Id: bash_completion,v 1.533 2003/02/26 01:17:54 ianmacd Exp $
|
||||
#
|
||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||
#
|
||||
@ -31,12 +31,12 @@ declare -r BASH_COMPLETION_DIR=${BASH_COMPLETION_DIR:=/etc/bash_completion.d} 2>
|
||||
#
|
||||
UNAME=$( uname -s )
|
||||
RELEASE=$( uname -r )
|
||||
if [ ${BASH_VERSINFO[1]} '>' 04 ]; then
|
||||
if [[ ${BASH_VERSINFO[1]} > 04 ]]; then
|
||||
default="-o default"
|
||||
dirnames="-o dirnames"
|
||||
filenames="-o filenames"
|
||||
fi
|
||||
[ ${BASH_VERSINFO[1]} = "05b" ] && nospace="-o nospace" || nospace=""
|
||||
[[ ${BASH_VERSINFO[1]} = "05b" ]] && nospace="-o nospace" || nospace=""
|
||||
|
||||
# Turn on extended globbing and programmable completion
|
||||
shopt -s extglob progcomp
|
||||
@ -56,7 +56,7 @@ complete -f -X '!*.@(zip|ZIP|jar|JAR|exe|EXE|pk3|war|wsz|ear|zargo)' unzip zipin
|
||||
complete -f -X '*.Z' compress znew
|
||||
complete -f -X '!*.@(Z|gz|tgz|Gz|dz)' gunzip zcmp zdiff zcat zegrep zfgrep zgrep zless zmore
|
||||
complete -f -X '!*.Z' uncompress
|
||||
complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|GIF|JPG|JP?(E)G|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA)' ee display
|
||||
complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|GIF|JP?(E)G|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA)' ee display
|
||||
complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|GIF|JPG|JP?(E)G|TIF?(F)|PNG|P[BGP]M|BMP|X[BP]M|RLE|RGB|PCX|FITS|PM)' xv qiv
|
||||
complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.Z))' gv ggv
|
||||
complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi
|
||||
@ -86,7 +86,7 @@ complete -f -X '!*.@(?(x)htm?(l))' netscape mozilla lynx opera w3m galeon curl d
|
||||
complete -u su usermod userdel passwd chage write chfn groups slay
|
||||
|
||||
# group commands see only groups
|
||||
[ ${BASH_VERSINFO[1]} '>' 04 ] &&
|
||||
[[ ${BASH_VERSINFO[1]} > 04 ]] &&
|
||||
complete -g groupmod groupdel newgrp 2>/dev/null
|
||||
|
||||
# bg completes with stopped jobs
|
||||
@ -315,7 +315,7 @@ _complete()
|
||||
case $prev in
|
||||
-o)
|
||||
options="default dirnames filenames"
|
||||
[ ${BASH_VERSINFO[1]} = "05b" ] && options="$options nospace"
|
||||
[[ ${BASH_VERSINFO[1]} = "05b" ]] && options="$options nospace"
|
||||
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
@ -348,7 +348,7 @@ _complete()
|
||||
if [[ "$cur" == -* ]]; then
|
||||
# relevant options completion
|
||||
options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"
|
||||
[ ${BASH_VERSINFO[1]} '>' 04 ] && options="$options -o"
|
||||
[[ ${BASH_VERSINFO[1]} > 04 ]] && options="$options -o"
|
||||
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
||||
else
|
||||
COMPREPLY=( $( compgen -A command -- $cur ) )
|
||||
@ -379,7 +379,7 @@ _chown()
|
||||
# first parameter on line or first since an option?
|
||||
if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then
|
||||
if [[ "$cur" == [a-zA-Z]*[.:]* ]] && \
|
||||
[ ${BASH_VERSINFO[1]} '>' 04 ]; then
|
||||
[[ ${BASH_VERSINFO[1]} > 04 ]]; then
|
||||
user=${cur%%?(\\)[.:]*}
|
||||
group=${cur#*[.:]}
|
||||
COMPREPLY=( $( compgen -P $user':' \
|
||||
@ -416,7 +416,7 @@ _chgrp()
|
||||
# first parameter on line or first since an option?
|
||||
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \
|
||||
[[ "$prev" == -* ]]; then
|
||||
[ ${BASH_VERSINFO[1]} '>' 04 ] && \
|
||||
[[ ${BASH_VERSINFO[1]} > 04 ]] && \
|
||||
COMPREPLY=( $( compgen -g $cur 2>/dev/null) )
|
||||
else
|
||||
_expand || return 0
|
||||
@ -704,7 +704,7 @@ _find()
|
||||
return 0
|
||||
;;
|
||||
-group)
|
||||
[ ${BASH_VERSINFO[1]} '>' 04 ] && \
|
||||
[[ ${BASH_VERSINFO[1]} > 04 ]] && \
|
||||
COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) )
|
||||
return 0
|
||||
;;
|
||||
@ -4592,7 +4592,7 @@ if [ ${#list[@]} -gt 0 ]; then
|
||||
# install new compspecs
|
||||
eval complete -F _filedir_xspec $filenames ${list[@]}
|
||||
fi
|
||||
unset list[@]
|
||||
unset list
|
||||
|
||||
# source completion directory definitions
|
||||
if [ -d $BASH_COMPLETION_DIR -a -r $BASH_COMPLETION_DIR -a \
|
||||
|
Loading…
x
Reference in New Issue
Block a user