> I'm trying to figure out how to do the right thing with non-filename 
> completions containing slashes in a function that was passed to complete 
> along 
> with -o filenames.
> 
> For example:
> 
> _foo()
> {
>   COMPREPLY=( $( compgen -W 'a/b c/d e/f/g' -- ${COMP_WORDS[COMP_CWORD]} ) )
> }
> complete -F _foo -o filenames foo
> 
> a/b, c/d and e/f/g are not file/path names but other completions that just 
> happen to contain slashes.  Whenever I want some of them, I don't want 
> file/dirname completion.
> 
> If I leave things as is in the above, "foo <TAB>" displays "b   d   g" 
> whereas 
> I'd want "a/b   c/d   e/f/g" displayed _but_ for example "foo a<TAB>" 
> properly 
> completes to "foo a/b " nevertheless.  So it's just the display of available 
> completions that is wrong from my POV (everything up to and including the 
> last 
> slash is missing).

I tracked down and fixed this.  The problem was that the effects of compopt
only lasted as long as the completions were being generated (in the above
example, the shell function execution) rather than through the entire
completion process, which includes listing possible matches.  The fix will
be in the next bash release.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    c...@case.edu    http://tiswww.tis.case.edu/~chet/


Reply via email to