cli/crash-report: make it simpler (uglier, honestly)

This commit is contained in:
Mitchell Hashimoto
2024-09-10 21:14:55 -07:00
parent 4e16624676
commit 11c3ca69f5
3 changed files with 49 additions and 51 deletions

View File

@@ -8,6 +8,7 @@ const configpkg = @import("../config.zig");
const Config = configpkg.Config;
const vaxis = @import("vaxis");
const input = @import("../input.zig");
const tui = @import("tui.zig");
const Binding = input.Binding;
pub const Options = struct {
@@ -61,12 +62,8 @@ pub fn run(alloc: Allocator) !u8 {
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 (can_pretty_print and !opts.plain and std.posix.isatty(stdout.handle)) {
if (tui.can_pretty_print and !opts.plain and std.posix.isatty(stdout.handle)) {
return prettyPrint(alloc, config.keybind);
} else {
try config.keybind.formatEntryDocs(