On 04/06/2022 19:30, Justin Donnelly wrote:
I like this solution. This isn't new, but does anybody know if there is a reason why `$w` is compared for equality to "*" as opposed to just checking whether it's a nonempty value (`-n`)? I think I'd generally prefer it to be consistent with the others, which has the added benefit of continuing to work if the asterisk is ever changed to something else.
Looking at the commit that introduced colourization, 9b7e776c0a5 (show color hints based on state of the git tree, 2012-10-10), it looks like
the author wanted the be as specific as possible in the check, with $w only being empty or holding a '*', while $i could hold multiple different indicators. Since the layout of the script has changed significantly since then, I'll submit a v5 shortly with the $w check altered.