pyinfra icon indicating copy to clipboard operation
pyinfra copied to clipboard

Use rich

Open Fizzadar opened this issue 4 years ago • 1 comments

Drop the custom progress bar.

Can potentially show logs in pager, etc.

Fizzadar avatar Apr 04 '22 06:04 Fizzadar

I think having an option to enable verbose & pretty output on a per-operation/fact level would be a nice feature.

I created a little FactBase mixin for logging output in a Rich way.

I find it super useful for one-off fact runs as eye-balling some text/object in Pyinfra's output was hard and error-prone, especially for facts returning multiple lines/items.

Optionally it will display a syntax highlighted code block with information relevant to gathering the fact – e.g. an SQL query behind a fact or lines matched with FindInFile.

See some examples: rich-fact

rich-fact-2

And for highlighting stdout from vital operations: Screenshot 2024-05-07 at 23 10 02

Would be happy to help on this if there's interest in having something like this.

This is part of our collection of operations/facts/tasks for installing, configuring and managing Oracle Databases. Was thinking of open sourcing it once it's battle tested enough.

olafurnielsen avatar May 07 '24 23:05 olafurnielsen