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

David Paleino dapal at debian.org
Sun Jan 8 12:43:06 UTC 2012


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

You can see this in action with our current dd(1) completion. I lost myself,
while debugging this, at around line 710 of the main script, i.e. I can
see that in my "set -x" log, but the subsequent log lines seem to come
from somewhere else. _split_longopt, maybe? (but I haven't passed -s to
_init_completion...). Anyone care to have a look? :)

Thanks,
David

(btw, tonight I released 1.99. No big announcements this time -- I was kinda
sleepy too -- I'll make a big announce on 2.0 proper)

-- 
 . ''`.   Debian developer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://deb.li/dapal
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20120108/7f9995da/attachment.pgp>


More information about the Bash-completion-devel mailing list