News for hackers. Stuff that matters.
Re:Show HN: Zli – A Batteries-Included CLI Framework for Zig by arp242 on Sunday May 25, 2025 @03:49PM (#44090487)
> I wish people wouldn't hardcode terminal escape codes.

A bunch of commonly used escape codes are pretty much universally identical. I wrote about this before: https://www.arp242.net/safeterm.html

By and large I think terminfo/$TERM is outdated, or at least partly. It's a 1970s/80s thing when terminals all did radically different things. But that hasn't been the case for decades now. You still need it for some things (kind of), but basic support like colours? Not so much.

Re:Show HN: Zli – A Batteries-Included CLI Framework for Zig by quotemstr on Sunday May 25, 2025 @04:16PM (#44090698)
Except all those times you don't want color at all.
Re:Show HN: Zli – A Batteries-Included CLI Framework for Zig by arp242 on Sunday May 25, 2025 @05:00PM (#44091080)
NO_COLOR exists, and is fairly widely supported. TERM=dumb to disable colour was always a hack at best because this also disables other things like "clear line" and generally leads to weird output.

> It's a Chesterton's fence.

It's not. The world has changed. Everyone uses \x1b[1m to make text bold today but in the past there were a few dozen ways from different vendors of (hardware) terminals to make text bold. But this situation no longer exists. Like I already said: you still need it for some things – there's a reason I compiled a "safe terminal escape code" list. But for many things you don't.

Re:Show HN: Zli – A Batteries-Included CLI Framework for Zig by quotemstr on Sunday May 25, 2025 @05:26PM (#44091296)
NO_COLOR is far from universally supported (even people who bother to check TERM don't know about it) and typically isn't configured to pass through sudo or ssh.
Re:Show HN: Zli – A Batteries-Included CLI Framework for Zig by arp242 on Sunday May 25, 2025 @05:38PM (#44091417)
> NO_COLOR is far from universally supported

I never claimed that. The sudo or ssh configuration is up to you. Or else there's |cat, which often works when NO_COLOR doesn't.

Either way, terminfo was never intended to allow users to disable colours. Certainly not via TERM=dumb – that was always a hack. If you want to disable colours then there are better ways.