[Bash-completion-devel] Bug with key=value options?

Ville Skyttä ville.skytta at iki.fi
Sun Jan 8 14:38:02 UTC 2012


On 2012-01-08 14:43, David Paleino wrote:
> Hello people,
> please consider the following snippet:
> 
> --->8---
> _foo() {
>     local cur prev words cword
>     _init_completion -n = || return
>     
>     case $cur in
>         bar=*)
>             cur=${cur#*=}
>             _filedir
>             return 0
>             ;;
>     esac
> 
>     _expand || return 0
> 
>     COMPREPLY=( $(compgen -W 'bar' -S'=' -- "$cur") )
>     return 0
> }
> complete -F _foo -o nospace foo
> ---8<---
> 
> What I get is:
> 
> $ foo bar=<TAB>
> abc
> bla
> foo
> $ foo bar=b<TAB>
> $ foo bla

What I get is (assuming there are abc, bla, and foo files in $PWD):

$ foo bar=<TAB>
abc  bla  foo
$ foo bar=b<TAB>
$ foo bar=bla

...so I suppose it's working as expected for me.  This is on Fedora 16,
bash-completion current git master, bash 4.2.20(1)-release.



More information about the Bash-completion-devel mailing list