Open Spiegie opened 5 days ago
This sounds like a useful enhancement. The ansi codes in the output do indeed complicate using the output in other programs. I would even suggest to create a new parameter --no-color
which prevents all ansi codes for colors and text formatting.
how would you implement it? Should i implement a function wrapping the bold function inside an own function that implements Style? This wrapper than contains logic about if the style is desired by the user? I would go as far as disabling color bold and all other ansi codes all together with a --plain or --artless flag.
What I dont like about this approach is, that i would have to wrap every style funktion, that messes with ansi codes. Can you hint me to a better solution?
for everyone who struggles with this, here is a workaround in Python https://stackoverflow.com/questions/14693701/how-can-i-remove-the-ansi-escape-sequences-from-a-string-in-python. Its a regex, so it should be easy to apply to your needs. nonetheless I think, my proposal is useful.
I am unsure about the best solution, too. The style hints are used in several places in the view
module without any abstraction.
Your suggestion sound viable to me. Would you give it a try and see how it works out?
It would be nice to disable bold printing in Report and where it is also implemented. I Think, this should be possible by passing a --no-bold flag or something to bartib itself not its subcommands or should be configurable with env-var.
I'm using Bartib in other Programs and the bold-formatting messes with my output-strings.