Re: Any way to force --styled-output?

Alex Bligh via curl-users <[email protected]> Sat, 30 May 2026 11:27:44 +0200
Newsgroups gmane.comp.web.curl.general
Message-ID <[email protected]>

> On 30 May 2026, at 02:14, 5HT2 via curl-users <[email protected]> wrote:
> 
> See subjectline, I don't see anything documented in curl(1) and trying the somewhat-standardized CLICOLOR / CLICOLOR_FORCE / COLORS / COLORTERM / similar do not appear to affect the output when curl is piped.
> 
> I'd like to preserve the styling when piping.

I don't know specifically with curl, but in general if you want to make a command that is piped think it is attached to a pty, you need to wrap it in something like this:
  https://github.com/abligh/pty
(that's my fork of something from APUE, patched so it can return the return code).

Note you may then want to make sure you disable the interactive progress bar etc.

If modifying the source is OK, and you want the opposite to "-s" (behave as when piped), it's probably as simple as changing
   config->global->isatty = isatty(fileno(stdout));
to
   config->global->isatty = forcetty || isatty(fileno(stdout));
where forcetty is your config option. It's possible isatty() is called elsewhere (though I don't see why it wouldn't use the cached version).

-- 
Alex Bligh

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html