renamed _file_and_dir() _filedir_xspec()

created _filedir(), which is used by cat, less, more, ln and strip, so that
  tilde expansion can be performed, prior to pathname expansion
This commit is contained in:
ianmacd 2002-01-23 23:36:30 +00:00
parent b212d50286
commit 1ad5366035

View File

@ -2,7 +2,7 @@
# #
# <![CDATA[ # <![CDATA[
# #
# $Id: bash_completion,v 1.67 2002/01/24 00:13:21 ianmacd Exp $ # $Id: bash_completion,v 1.68 2002/01/24 00:36:30 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -37,9 +37,6 @@ shopt -s extglob progcomp
# Make directory commands see only directories # Make directory commands see only directories
complete -d mkdir rmdir pushd complete -d mkdir rmdir pushd
# Make file commands see only files
complete -f cat less more ln strip
# the following section lists completions that are redefined later # the following section lists completions that are redefined later
# START exclude -- do NOT remove this line # START exclude -- do NOT remove this line
#complete -f -X '*.bz2' bzip2 #complete -f -X '*.bz2' bzip2
@ -1611,7 +1608,21 @@ _configure_func ()
} }
complete -F _configure_func configure complete -F _configure_func configure
_file_and_dir() _filedir()
{
local IFS cur
IFS=$'\t\n'
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
_expand || return 0
COMPREPLY=( $( eval compgen -f $cur ) $( compgen -d $cur ) )
}
complete -F _filedir -o filenames cat less more ln strip
_filedir_xspec()
{ {
local IFS cur xspec local IFS cur xspec
@ -1649,7 +1660,7 @@ list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' \
if [ ${#list[@]} -gt 0 ]; then if [ ${#list[@]} -gt 0 ]; then
eval complete -r ${list[@]} eval complete -r ${list[@]}
# install new compspecs # install new compspecs
eval complete -F _file_and_dir -o filenames ${list[@]} eval complete -F _filedir_xspec -o filenames ${list[@]}
fi fi
unset list[@] unset list[@]