Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Recursive completion (was: RE: Reading completion manual)



May be, this solves the original problem?

> 
> As most of us, I don't like the idea of conditions with side 
> effects. But I don't like the Sven's suggestion of replacing 
> conditions with shell code either (at least, with *THIS* code :-) 
> Even more, as it does not solve the original problem - you still 
> have to save parameters and restore them after that. I'd suggest 
> something in between - conditions set special parameters 
> (elements of hash?) that can be used to extract matched 
> substrings/words. That is almost the same, as Sven's suggestion, 
> but probably more user-friendly :) something like
> 
> if [[ -between string1 string2 ]]; then
>    local -a nwords
>    nwords=(words[$FIRST,$LAST])
>     ...
> 
> 

if [[ -between string1 string2 ]]; then
    compalso  --from=first --to=last

compalso() {
   for i in $*
     case $i in
        --from=* )
           from=${i#--from=}
        ;;
  ....
   words=($words[$from,$to])
 ...
}

I bet, this can be written as one line :-)

cheers

/andrej



Messages sorted by: Reverse Date, Date, Thread, Author