From 1e91efbbe519b2d02b96c4a6124a8596a3c28cc4 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 6 Aug 2024 12:40:36 -0500 Subject: [PATCH] cli/list-keybinds: prevent ios, tvos, and watchos from pretty printing These oses don't supply a tty layer, which prevents us from using the libvaxis tty. Eventually we can add in using stdout as a writer. For now, we just don't pretty print there. --- src/cli/list_keybinds.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cli/list_keybinds.zig b/src/cli/list_keybinds.zig index 0f2837ca7..28815715e 100644 --- a/src/cli/list_keybinds.zig +++ b/src/cli/list_keybinds.zig @@ -57,8 +57,13 @@ pub fn run(alloc: Allocator) !u8 { defer config.deinit(); const stdout = std.io.getStdOut(); + + const can_pretty_print = switch (builtin.os.tag) { + .ios, .tvos, .watchos => false, + else => true, + }; // Despite being under the posix namespace, this also works on Windows as of zig 0.13.0 - if (std.posix.isatty(stdout.handle) and !opts.plain) { + if (can_pretty_print and !opts.plain and std.posix.isatty(stdout.handle)) { return prettyPrint(alloc, config.keybind); } else { try config.keybind.formatEntryDocs(