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

(P:string:) glob qualifier-like effect for parameter expansion



hello,

i was looking for a simple way to achieve *(P:--header:),
except my use case is parameter expansion, not globbing.

i've got something like::

  fmt="\
  From: %an <%ae>
  Date: %aD
  Subject: %s
  "
  set -A headers "${(@f):-"$(git show -s --format=$fmt $rev)"}"

and i'd like to add::

  mime-construct "${(@???)headers}" ...

to get::

  --header "From: ..." --header "Date: ..." --header "Subject: ..."

except it looks i'm "doomed" to a loop::

  declare -a headers
  for h; do
    headers+=(--header $h)
  done < <(git show -s --format=$fmt $rev)
  mime-construct "${(@)headers}" ...

-- 
roman



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