summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2026-01-06 18:45:17 -0500
committerRobby Zambito <contact@robbyzambito.me>2026-01-06 20:43:49 -0500
commitb87412ee66197d4c89f1fbf93b32fe63ed1c63ab (patch)
tree00613d0d3f7178d0c5b974ce04a752443e9a816e /src/main.zig
parent025a5344c8c922a8f46c4ee0e73a00ce0c3c4790 (diff)
Restructuring
Add a bunch of tests for the client
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig
index 47992af..a413fba 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -6,6 +6,8 @@ const yazap = @import("yazap");
const Message = zits.MessageParser.Message;
const Server = zits.Server;
+const serverSubcommand = @import("./subcommand/server.zig").main;
+
pub fn main() !void {
var dba: std.heap.DebugAllocator(.{}) = .init;
defer _ = dba.deinit();
@@ -67,7 +69,7 @@ pub fn main() !void {
info.server_name = name;
}
- try @import("./server/main.zig").main(gpa, info);
+ try serverSubcommand(gpa, info);
return;
} else if (matches.subcommandMatches("pub")) |_| {
std.debug.print("Unimplemented\n", .{});
@@ -76,3 +78,25 @@ pub fn main() !void {
try app.displayHelp(io);
}
+
+pub const std_options: std.Options = .{
+ // By default, in safe build modes, the standard library will attach a segfault handler to the program to
+ // print a helpful stack trace if a segmentation fault occurs. Here, we can disable this, or even enable
+ // it in unsafe build modes.
+ .enable_segfault_handler = true,
+ // This is the logging function used by `std.log`.
+ .logFn = myLogFn,
+};
+
+fn myLogFn(
+ comptime level: std.log.Level,
+ comptime scope: @EnumLiteral(),
+ comptime format: []const u8,
+ args: anytype,
+) void {
+ if (scope == .zits) {
+ std.log.defaultLog(level, std.log.default_log_scope, format, args);
+ } else {
+ std.log.defaultLog(level, scope, format, args);
+ }
+}