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

param expansion flags



I'm trying to write a completion file rake (a make like thing for ruby).
You can get a list of targets like this:

    % rake -sT
    rake apidoc                   # Build the apidoc HTML Files
    rake appdoc                   # Build the appdoc HTML Files
    rake clear_logs               # Clears all *.log files in log/

And I'm trying to get that lot into an array parameter that looks like
this:

    targets=(
        'apidoc[Build the apidoc HTML Files]'
        'appdoc[Build the appdoc HTML Files]'
        'clear_logs[Clears all *.log files in log/]'
    )

I've gotten part of the way there, but I can't figure out the rest.  So
far, I've gotten it to split out the lines, remove "rake " from the
front and start putting the initial square bracket in.

    % arr=( ${${${(f)~~"$(rake -sT)"}#rake }/ *# /[} )

Can anyone offer me some advice?

-Dom



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