Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Justifying text output
- X-seq: zsh-users 7156
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Justifying text output
- Date: Fri, 12 Mar 2004 10:55:56 +0000
- In-reply-to: <1mm7og67rpkdy.dlg@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <1mm7og67rpkdy.dlg@xxxxxxxxxxxxxxxx>
On Mar 12, 3:01am, Thorsten Kampe wrote:
}
} there any way to make the "[ ok ]"/"[ failed ]" messages on the right
} justified?
Change each "echo" from e.g. this:
echo "${ltgreen}* ${white}compiling $file [ ${ltgreen}ok ${white}]"
To this:
echo ${(r:70:):-"${ltgreen}* ${white}compiling $file"}"[ ${ltgreen}ok ${white}]"
Note the placement of the quotes and closing curly-brace.
The (r:70:) parameter flag counts all characters -- it doesn't know that
${green} and ${white} expand to zero-width color changes -- so you have
to increase the padding to compensate. You could do e.g.:
((PAD = COLUMNS - 12 + ${#ltgreen} + ${#white}))
and then
echo ${(r:PAD:):-"${ltgreen}* ${white}compiling $file"} ...
Messages sorted by:
Reverse Date,
Date,
Thread,
Author