Artifact 18c97fa688b231ddd006987885f017b0d07c4cd491048f0f1dd51e8dded4d9fc:
- File
src/main.zig
— part of check-in
[0ae7fb2622]
at
2026-07-08 21:53:01
on branch trunk
— Scaffold zit: Zig project + RFC references + module layout
Fossil-in-Zig, ported from the four RFC drafts (docs/rfcs/). Layout mirrors the RFC layering: delta -> artifact -> repostate -> sync. delta int codec + checksum and artifact naming/Z-card implemented with RFC-derived test vectors; everything else stubbed against its section. Builds clean; zig build test green. See docs/HANDOFF.md. (user: dmestas, size: 1589) [annotate] [blame] [check-ins using]
//! zit — command-line entry point. //! //! The heavy lifting lives in the `zit` library module (src/root.zig and the //! per-RFC modules it re-exports). This file is only the CLI surface. const std = @import("std"); const Io = std.Io; const zit = @import("zit"); pub fn main(init: std.process.Init) !void { const arena = init.arena.allocator(); const args = try init.minimal.args.toSlice(arena); var stdout_buffer: [1024]u8 = undefined; var stdout_writer: Io.File.Writer = .init(.stdout(), init.io, &stdout_buffer); const out = &stdout_writer.interface; const cmd = if (args.len >= 2) args[1] else "help"; if (std.mem.eql(u8, cmd, "version")) { try out.writeAll("zit 0.0.0 (targets Fossil RFC rev " ++ zit.rfc_revision ++ ")\n"); } else if (std.mem.eql(u8, cmd, "help") or std.mem.eql(u8, cmd, "-h") or std.mem.eql(u8, cmd, "--help")) { try out.writeAll(usage); } else { try out.writeAll("zit: unknown command '"); try out.writeAll(cmd); try out.writeAll("'\n\n"); try out.writeAll(usage); try out.flush(); std.process.exit(2); } try out.flush(); } const usage = \\zit — a Fossil version-control system in Zig \\ \\usage: zit <command> [args] \\ \\commands: \\ version print the version \\ help show this help \\ \\This is a scaffold. Implementation follows the RFC layering in docs/rfcs/: \\ delta -> artifact -> repostate -> sync \\ ; test "usage text is present" { try std.testing.expect(usage.len > 0); }