HejHej,

I was writing a bash-completion for a command of a project I am working
at. Thing is, we have commands like this:

> jailhouse cell stats --name "Hello World"

This "Hello World" is parsed from sysfs and that can be done with simple
bash. But how can I program the bash-completion in a way that it would
auto-complete this:

> jailhouse cell stats --name Hello<tab>

At the moment it can't handle this and would just print the two words as
single option. The corresponding code looks like this:

> local cur quoted_cur quoted
> 
> _quote_readline_by_ref "${COMP_WORDS[COMP_CWORD]}" quoted_cur
> ....
> for n in /sys/devices/jailhouse/cells/*; do
>         _quote_readline_by_ref "${n##*/}" quoted
>         names="${names} ${quoted}"
> done
> ....
> COMPREPLY=( $( compgen -W "--name ${names}" -- ${quoted_cur} ) )

That doesn't work. I see that you guys solved it for stuff like
filenames, but how, I can't seem to figure it out.

Any help would be appreciated (I am not registered on the list).

-- 
The explanation requiring the fewest assumptions is the most likely to be
correct.
                -- William of Occam
--
                                                          best regards,
                                                            - Benjamin Block

Attachment: pgpasoNRye9y2.pgp
Description: PGP signature

_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel

Reply via email to