mirror of
https://git.robbyzambito.me/zits
synced 2026-02-04 03:34:48 +00:00
Restructuring
Add a bunch of tests for the client
This commit is contained in:
26
src/main.zig
26
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user