Hello, Apologies if this is not an appropriate list to post a question like this (pointers elsewhere welcome), but here goes:
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). If I remove "-o filenames", this simple example works as expected. But in real life _foo() is not that simple and in many other cases within it filename completion is desired so it can't just be removed. I tried "compopt +o filenames" with bash 4.x inside _foo() but that didn't help, and anyway I'm looking for a solution that would preferably work at least with bash 3.x, if not 2.05+ (for the bash-completion project at http://bash- completion.alioth.debian.org). Ideas? Please Cc me in replies, I'm not subscribed to bug-bash at the moment.