╭ changed ──────╮ │src/command.zig│ ╰───────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────╮ │ 7 upload_pack, │ │ 8 receive_pack, │ │ 9 http_backend, │ │10 + serve, │ │11 }; │ │12 │ │13 const Help = struct {│ ╰─────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │43 , │ │44 .example = │ │45 \\haxy http-backend │ │46 + , │ │47 + }, │ │48 + .serve => .{ │ │49 + .name = "serve", │ │50 + .descrip = │ │51 + \\a long-running HTTP server forwarding receive-pack and upload-pack.│ │52 + , │ │53 + .example = │ │54 + \\haxy serve --http-listen 127.0.0.1:8080 --project-root /srv/git │ │55 , │ │56 }, │ │57 }; │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────╮ │113 │ │114 // flags that can have a value associated with them │ │115 // must be included here │ │106 - const value_flags = std.StaticStringMap(void).initComptime(.{}); │ │116 + const value_flags = std.StaticStringMap(void).initComptime(.{ │ │117 + .{"--http-listen"}, │ │118 + .{"--project-root"}, │ │119 + }); │ │120 │ │121 pub fn init(allocator: std.mem.Allocator, args: []const []const u8) !CommandArgs {│ │122 const arena = try allocator.create(std.heap.ArenaAllocator); │ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────╮ │216 options: xit.net_server_receive_pack.Options, │ │217 }, │ │218 http_backend, │ │219 + serve: struct { │ │220 + http_listen: []const u8, │ │221 + project_root: []const u8, │ │222 + }, │ │223 │ │224 pub fn initMaybe(cmd_args: *CommandArgs) !?Command(repo_kind, hash_kind) {│ │225 const command_kind = cmd_args.command_kind orelse return null; │ ╰───────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │252 │ │253 return .http_backend; │ │254 }, │ │255 + .serve => { │ │256 + if (cmd_args.positional_args.len != 0) return null; │ │257 + │ │258 + return .{ .serve = .{ │ │259 + .http_listen = (cmd_args.get("--http-listen") orelse null) orelse "127.0.0.1:8080",│ │260 + .project_root = (cmd_args.get("--project-root") orelse null) orelse ".", │ │261 + } }; │ │262 + }, │ │263 } │ │264 } │ │265 }; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯