Buy commercial curl support. We
help you work out your issues, debug your libcurl applications, use the API,
port to new platforms, add new features and more. With a team lead by the
curl founder Daniel himself.
Re: Any way to force --styled-output?
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Alex Bligh via curl-users <curl-users_at_lists.haxx.se>
Date: Sat, 30 May 2026 11:27:44 +0200
> On 30 May 2026, at 02:14, 5HT2 via curl-users <curl-users_at_lists.haxx.se> 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).
Date: Sat, 30 May 2026 11:27:44 +0200
> On 30 May 2026, at 02:14, 5HT2 via curl-users <curl-users_at_lists.haxx.se> 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.htmlReceived on 2026-05-30