ZSH completion for kdesrc-build

Thiago Macieira thiago at kde.org
Sat Jan 11 16:04:13 GMT 2014

On sábado, 11 de janeiro de 2014 11:38:25, Ivan Čukić wrote:
> function _ksrccomp() {
>   reply=(`grep identifier kde_projects.xml | sed 's/^[^"]*"//' | sed
> 's/".*//' | sort -u`)
> }

Replace the grep and two sed with just one sed:

   reply=(`sed -n 's/.*identifier="\(.*\)".*/\1/p' kde_projects.xml | sort -u`)

You can also use zsh expansion modifiers "o" and "u" to sort and uniquify:

    reply=(`sed -n 's/.*identifier="\(.*\)".*/\1/p' kde_projects.xml`)

If you want to go further, you can replace the sed with a while read :-)

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20140111/61b3fe7a/attachment.sig>

More information about the kde-core-devel mailing list