_rpm(): default to directory completion as a last resort in more cases

This commit is contained in:
ianmacd 2002-02-14 19:07:42 +00:00
parent 93f113e34d
commit 5629a67cbb

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05a # bash_completion - some programmable completion functions for bash 2.05a
# #
# $Id: bash_completion,v 1.113 2002/02/14 17:49:43 ianmacd Exp $ # $Id: bash_completion,v 1.114 2002/02/14 20:07:42 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -645,9 +645,8 @@ _rpm()
# completing on # completing on
[ "$suffix" != "${1:0:${#suffix}}" ] && suffix="" [ "$suffix" != "${1:0:${#suffix}}" ] && suffix=""
COMPREPLY=( ${COMPREPLY[@]} $( compgen -G $cur\*${1:${#suffix}} ) ) COMPREPLY=( ${COMPREPLY[@]} $( compgen -G $cur\*${1:${#suffix}} ) )
# directory completion if all else fails and current word # directory completion if all else fails
# contains a slash if [ ${#COMPREPLY[@]} = 0 ]; then
if [ ${#COMPREPLY[@]} = 0 ] && [[ $cur == */* ]]; then
COMPREPLY=( $( compgen -d $cur ) ) COMPREPLY=( $( compgen -d $cur ) )
fi fi
} }
@ -825,24 +824,28 @@ _rpm()
_expand || return 0 _expand || return 0
# complete on .tar files # complete on .tar files
COMPREPLY=( $( compgen -G $cur\*.+(tgz|tar.+(gz|bz2)) ) ) COMPREPLY=( $( compgen -G $cur\*.+(tgz|tar.+(gz|bz2)) ) )
[ ${#COMPREPLY[@]} = 0 ] && \
COMPREPLY=( $( compgen -d $cur ) )
fi fi
return 0 return 0
;; ;;
--re@(build|compile)) --re@(build|compile))
_expand || return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W 'nodeps' ${cur_nodash#-} ) ) COMPREPLY=( $( compgen -W 'nodeps' ${cur_nodash#-} ) )
dashify dashify
return 0 return 0
fi fi
_expand || return 0
# complete on source RPMs # complete on source RPMs
COMPREPLY=( $( compgen -G $cur\*.src.rpm ) ) COMPREPLY=( $( compgen -G $cur\*.src.rpm ) )
[ ${#COMPREPLY[@]} = 0 ] && COMPREPLY=( $( compgen -d $cur ) )
return 0 return 0
;; ;;
--tarbuild) --tarbuild)
_expand || return 0 _expand || return 0
# complete on tarred sources # complete on tarred sources
COMPREPLY=( $( compgen -G $cur\*.+(tgz|tar.+(gz|bz2)) ) ) COMPREPLY=( $( compgen -G $cur\*.+(tgz|tar.+(gz|bz2)) ) )
[ ${#COMPREPLY[@]} = 0 ] && COMPREPLY=( $( compgen -d $cur ) )
return 0 return 0
;; ;;
--@(re|add)sign) --@(re|add)sign)