[Bash-completion-devel] [SCM] bash-completion branch, master, updated. 1.90-50-g834379e

Ville Skyttä ville.skytta at iki.fi
Sun Nov 20 10:05:23 UTC 2011


On 11/20/2011 02:45 AM, Igor Murzov wrote:

> This works bad for me.

Yeah, I anticipated it might not work everywhere, hence the "probably
needs adjustment to be more generic" TODO comment.

> Even *.so files are not deleted, because ls shows them with '*' like "vgpreload_core-x86-linux.so*".

I suppose that means -F ends up in your ls arguments somehow.  Any ideas
why that would happen when the command invoked is "command ls -1"?  If
that happens, I'm sure that you'll find many other completions broken
somehow as well.

> What about something like this?:
> ------------------------------------------
> $ for f in /usr{,/local}/lib{,64}/valgrind/*; do
>     [[ -x "$f" && "$f" != *.so ]] && echo "$f" | sed -ne 's/^.*\/\(.*\)-\([^-]*\)-\([^-]*\)/\1/p'
> done

Seems to work for me.  But it could be improved at least to test the !=
*.so case before the -x to save some stat calls, use printf instead of
echo, and drop the unnecessary quoting inside [[ ]].

>>    # "yes", "yes|no", etc (but not "string", "STR",
>>    # "hint1,hint2,...")
>>    yes|+([a-z0-9])\|+([a-z0-9\|]))
> 
> What about dash? Line like this "--smc-check=none|stack|all|all-non-file" is not parsed properly.

I don't think my valgrind (3.6.1) has any of those.  Feel free to add if
it doesn't seem it'd break anything.

>>    # Note: intentionally using COMP_WORDS and COMP_CWORD instead of
>>    # words and cword here due to splitting on = causing index differences
> 
> But using COMP_WORDS directly will brake for any argument, that contains
> character from COMP_WORDBREAKS, for example for --log-socket=ipaddr:port.

I don't see a sane and maintainable way to make this work with using
words instead of COMP_WORDS.



More information about the Bash-completion-devel mailing list