[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Non-filename completions containing slashes and -o filenames
From: |
Chet Ramey |
Subject: |
Re: Non-filename completions containing slashes and -o filenames |
Date: |
Thu, 30 Jul 2009 10:55:40 -0400 |
> 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 chet@case.edu http://tiswww.tis.case.edu/~chet/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Non-filename completions containing slashes and -o filenames,
Chet Ramey <=