From a6358d5156af0902600e542337e3548e957fd8aa Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Tue, 18 Feb 2025 17:48:21 +0100 Subject: [PATCH] feat: add -C,--color option to enable color if stdout is not a tty --- src/main.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index 5741878..6b354ff 100644 --- a/src/main.zig +++ b/src/main.zig @@ -20,6 +20,7 @@ pub fn main() !void { \\-t, --theme Select theme to use. \\-d, --default Set the language to use if guessing failed (default: conf). \\-s, --show-language Show detected language in output. + \\-C, --color Always produce color output, even if stdout is not a tty. \\--html Output HTML instead of ansi escape codes. \\--list-themes Show available themes. \\--list-languages Show available language parsers. @@ -68,7 +69,7 @@ pub fn main() !void { if (res.args.@"list-languages" != 0) return list_langs(writer); - if (!stdout_file.supportsAnsiEscapeCodes()) + if (res.args.color == 0 and !stdout_file.supportsAnsiEscapeCodes()) return plain_cat(res.positionals); var conf_buf: ?[]const u8 = null;