地圖 (Jido) is a lightweight Unix TUI file explorer designed for speed and simplicity.
at v0.4.0 41 lines 1.2 kB view raw
1const std = @import("std"); 2const builtin = @import("builtin"); 3 4const App = @import("app.zig"); 5 6const config = &@import("./config.zig").config; 7const vaxis = @import("vaxis"); 8 9var app: App = undefined; 10 11pub fn main() !void { 12 var gpa = std.heap.GeneralPurposeAllocator(.{}){}; 13 defer _ = gpa.deinit(); 14 const alloc = gpa.allocator(); 15 16 config.parse(alloc) catch |err| switch (err) { 17 error.ConfigNotFound => {}, 18 error.MissingConfigHomeEnvironmentVariable => { 19 std.log.err("Could not read config due to $HOME or $XDG_CONFIG_HOME not being set.", .{}); 20 return; 21 }, 22 error.SyntaxError => { 23 std.log.err("Could not read config due to a syntax error.", .{}); 24 return; 25 }, 26 else => { 27 std.log.err("Could not read config due to an unknown error.", .{}); 28 return; 29 }, 30 }; 31 32 app = try App.init(alloc); 33 defer app.deinit(); 34 35 try app.run(); 36} 37 38pub fn panic(msg: []const u8, trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn { 39 app.vx.deinit(app.alloc, app.tty.anyWriter()); 40 std.builtin.default_panic(msg, trace, ret_addr); 41}