╭ changed ───╮ │src/main.zig│ ╰────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────╮ │3 const xit = @import("xit"); │ │4 const rp = xit.repo; │ │5 const cmd = @import("./command.zig");│ │6 +const serve = @import("./serve.zig");│ │7 │ │8 pub const RunOpts = struct { │ │9 out: *std.Io.Writer, │ ╰────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │74 }, │ │75 .help => |cmd_kind_maybe| try cmd.printHelp(cmd_kind_maybe, run_opts.out), │ │76 .cli => |cli_cmd| { │ │77 + if (cli_cmd == .serve) { │ │78 + try serve.run(repo_kind, any_repo_opts, io, allocator, cwd_path, .{ │ │79 + .http_listen = cli_cmd.serve.http_listen, │ │80 + .project_root = cli_cmd.serve.project_root, │ │81 + }, run_opts.err); │ │82 + return; │ │83 + } │ │84 + │ │85 // some commands allow the path to be specified. for all others, just use the cwd path. │ │86 const work_path = switch (cli_cmd) { │ │87 .upload_pack => |upload_pack| try std.fs.path.resolve(allocator, &.{ cwd_path, upload_pack.dir }),│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────╮ │92 try xit.net_server_http_backend.sendNotFound(&http_stdout_writer.interface);│ │93 return; │ │94 }, │ │95 + .serve => unreachable, │ │96 }; │ │97 defer allocator.free(work_path); │ │98 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │167 │ │168 var stdin_buf: [repo_opts.net_buffer_size]u8 = undefined; │ │169 var stdin_reader = std.Io.File.stdin().reader(io, &stdin_buf); │ │160 - try repo.httpBackend(io, allocator, &stdin_reader.interface, &stdout_writer.interface, .{ │ │170 + try repo.httpBackend(io, allocator, &stdin_reader.interface, &stdout_writer.interface, .cgi, .{│ │171 .request_method = request_method, │ │172 .handler = handler, │ │173 .suffix = suffix, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │177 .protocol_version = xit.net_server_common.detectProtocolVersion(environ_map),│ │178 }); │ │179 }, │ │180 + .serve => unreachable, │ │181 } │ │182 } │ │183 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯