- _command(): stop wildcards from expanding prior to handing off command line

for subcompletion
This commit is contained in:
ianmacd 2002-04-11 22:24:08 +00:00
parent b93f310595
commit af6559deff

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.264 2002/04/08 16:30:59 ianmacd Exp $ # $Id: bash_completion,v 1.265 2002/04/12 00:24:08 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -1818,16 +1818,15 @@ _command()
# so we can set them before handing off to regular # so we can set them before handing off to regular
# completion routine # completion routine
# set current token number to 1 less than now
COMP_CWORD=$(( $COMP_CWORD - 1 ))
# get function name # get function name
func=${cspec#*-F } func=${cspec#*-F }
func=${func%% *} func=${func%% *}
# get current command line minus initial command # get current command line minus initial command
cline="${COMP_LINE#$1 }" cline="${COMP_LINE#$1 }"
# split current command line tokens into array # split current command line tokens into array
COMP_WORDS=( $cline ) COMP_WORDS=( "$cline" )
# set current token number to 1 less than expanded line
COMP_CWORD=$(( ${#COMP_WORDS[@]} - 1 ))
cur=${COMP_WORDS[COMP_CWORD]}
$func $cline $func $cline
# remove any \: generated by a command that doesn't # remove any \: generated by a command that doesn't
# default to filenames or dirnames (e.g. sudo chown) # default to filenames or dirnames (e.g. sudo chown)