Re: possible bug in autocompletion
On Wed, Sep 19, 2012 at 9:55 PM, Jeff King <peff@peff.net> wrote:
Show 6 quoted lines
> I have no idea if that internal to bash's filename completion, or if
> there is some easy facility offered to programmable completions to do
> the same thing. I don't think this is a high priority, but it would be
> nice to handle it. And moreover, I am really wondering if we are missing
> some solution that bash is providing to help us with the quoting issues.
> Surely we are not the first completion script to come up against this.
I found a much easier solution:
- COMPREPLY=($(compgen -P "${2-}" -S "${4- }" -W "$1" -- "${3-$cur}"))
+ COMPREPLY=($(compgen -P "${2-}" -S "${4- }" -W "$(quote "$1")"
-- "${3-$cur}"))But what about the people that don't have bash-completion?
BTW:
quote()
{
local quoted=${1//\'/\'\\\'\'}
printf "'%s'" "$quoted"
}--
Felipe Contreras