Re: [PATCH v2 1/3] chainlint: sidestep impoverished macOS "terminfo"
From: Eric Sunshine <hidden>
Date: 2022-11-11 17:15:30
On Fri, Nov 11, 2022 at 11:44 AM Eric Sunshine [off-list ref] wrote:
On Fri, Nov 11, 2022 at 10:02 AM Ævar Arnfjörð Bjarmason [off-list ref] wrote:quoted
I also wonder to what extent this needs to be re-inventing Term::ANSIColor, which has shipped with Perl since 5.6, so we can use it without worrying about version compat, but that's another topic...Gah, why didn't I know about this sooner?! [...] Since it's been shipping with Perl for quite some time, Term::ANSIColor would be a much nicer solution; worth looking into.
In retrospect, I may have looked at Term::ANSIColor at the time but decided to avoid it since it assumes the terminal understands ANSI codes, and I was looking for a more general solution which respected the terminal's capabilities as reported by "terminfo". And, reading up on it now, I'm not finding much benefit to Term::ANSIColor over what is already implemented in chainlint.pl. Particularly disheartening is that (as far as I can tell) Term::ANSIColor doesn't provide a way to interrogate whether or not it is suitable to use ANSI codes with the terminal in question, but instead makes a blanket assumption that the terminal supports ANSI codes unconditionally. So, I think the fixed-up colorizing as implemented by v2 of this patch series is good enough for now. It can always be revisited later if something warrants it.