Init style output with python?
John Machin
sjmachin at lexicon.net
Sat May 5 19:58:04 EDT 2007
On May 6, 9:27 am, "Maxim Veksler" <hq4e... at gmail.com> wrote:
> Hi list,
>
> I'm working on writing sanity check script, and for aesthetic reasons
> I would like the output be in the formatted like the gentoo init
> script output, that is:
> """
> Check for something .................................. [OK]
> Check for something else ..........................[FAIL]
> """
>
> Is there are frame work or something in python that would allow me to
> do this (quickly) ?
> If not, ideas how I should I be getting this boring task of:
> 1. get screen width
Is it not (a) safe (b) sensible to assume a minimum width (say 79) and
avoid the whole question of determining the terminal width?
> 2. get output string length
> 3. get out status length
> 4. calculate space
> 5. print string, print space, print status, print newline
Surely you don't need assistance with steps 2 - 5 ...
> what happens if user changes textual terminal "resolution" ?
Something rather unaesthetic, I imagine.
More information about the Python-list
mailing list