[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $2 in complete function doesn't like ':' character
From: |
Ives Aerts |
Subject: |
Re: $2 in complete function doesn't like ':' character |
Date: |
Wed, 26 Sep 2001 15:42:15 +0200 |
User-agent: |
Mutt/1.2.5i |
Chet Ramey wrote:
> Ives Aerts wrote:
> > Description:
> > According to the documentation, the second arg ($2) passed to
> > a completion function should contain the word being completed
> > and the third arg ($3) the word preceding the word being
> > completed.
> >
> > However, if the word being completed contains a ':' character,
> > only the part after the ':' is passed as $2 to the completion
> > function.
> >
> > Repeat-By:
> > > function _blah_complete() { echo -e "\n-$1-$2-$3-"; }
> > > complete -F _blah_complete blah
> > > blah arg1 arg2 arg3:and:more<TAB>
> > -blah-more-arg2-
> >
> > Expected result:
> > -blah-arg3:and:more-arg2-
> >
> > or even (if the ':' splits "arg3:and:more" in three words):
> > -blah-more-and-
>
> `:' splits words for the completion code. The intent was to be able to
> complete pathnames in colon-separated lists. If you quote the colon
> with a backslash, you'll get the entire word (with backslashes intact)
> passed to your completion function.
But if that's the case, shouldn't the example given then return
"-blah-more-and-" ???
To give some background: I'm using ClearCase and trying to implement
completion for commands like "cleartool lstype trtype:TRIGGER_NAME"
and "cleartool lstype brtype:BRANCH_NAME". I'm trying to complete the
NAME after the colon, based on the type information given before the
colon.
I suppose I could look into COMP_CWORD a COMP_WORDS, but the man page
seemed to indicate that the information I need would be passed in $2
or $3.
Cheers,
-Ives
______________________________________________________________________
Ives Aerts (senior R&D engineer) Sony Visual Products Europe
Ives.Aerts@sonycom.com http://www.nee-b.sonycom.com
`Repeat after me the ClearCase directory mantra: Directories do not
contain elements; Elements do not have names.' (Lezz Giles)