Clint Adams <[EMAIL PROTECTED]> writes:

>> Since I'm new to zsh, some parts of the patch might be suboptimal.  Feel 
>> free to
>> alter it.  The bit I'm not sure about is:
>> 
>> -  compadd ${${$(dchroot -l)[3,-1]%,}:#\[*\]} && ret=0
>> +  compadd $(echo ${$(dchroot -l)[3,-1]%,} | sed -e 's/\[//g' -e 's/\]//g' | 
>> sort | uniq)
>> 
>> The output of dchroot:
>> 
>> % dchroot -l
>> Available chroots: experimental, fake, sarge [stable, sarge-backports], sid 
>> [unstable, unstable-sbuild], sid-block [sid-block], sid-file, 
>> sid-file-source, sid-snap, sid-snap-source, testsnap, testsnap-source
>> 
>> The ,[] all need stripping, and duplicates need removing.  The old code 
>> assumes
>> there will only be one name in square brackets, but this is no longer the 
>> case.
>> I didn't find a way to do this with the zsh shell ${} operations.
>
> Yes, you can do it with something like this (the line break is literal)
>
> ${(os:,:)${${${"$(dchroot -l)"#Available chroots: }/\[*\]/}//[  
> ]/}}
>
> I'll tweak the patch.

That's not quite right:

% echo ${(os:,:)${${${"$(dchroot -l)"#Available chroots:}/\[*\]/}//[
]/}}
experimental  fake  sarge   sid-file  sid-file-source  sid-snap  
sid-snap-source  testsnap  testsnap-source
hardknott% dchroot -l
Available chroots: experimental, fake, sarge [stable, sarge-backports], sid 
[unstable, unstable-sbuild], sid-block [sid-block], sid-file, sid-file-source, 
sid-snap, sid-snap-source, testsnap, testsnap-source

The output should be:
experimental fake sarge stable sarge-backports sid unstable unstable-sbuild 
sid-block sid-file sid-file-source sid-snap sid-snap-source testsnap 
testsnap-source

i.e. the contents of the square brackets should not be eliminated.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Attachment: pgpGzimSZEA0y.pgp
Description: PGP signature

Reply via email to