╭ changed ──────╮ │src/command.zig│ ╰───────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────╮ │4 const hash = xit.hash; │ │5 │ │6 pub const CommandKind = enum {│ │7 - upload_pack, │ │8 - receive_pack, │ │9 - http_backend, │ │7 serve, │ │8 ssh_helper, │ │9 }; │ ╰─────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │16 │ │17 fn commandHelp(command_kind: CommandKind) Help { │ │18 return switch (command_kind) { │ │22 - .upload_pack => .{ │ │23 - .name = "upload-pack", │ │24 - .descrip = │ │25 - \\send what is fetched from the repository. │ │26 - , │ │27 - .example = │ │28 - \\haxy upload-pack <directory> │ │29 - , │ │30 - }, │ │31 - .receive_pack => .{ │ │32 - .name = "receive-pack", │ │33 - .descrip = │ │34 - \\receive what is pushed into the repository. │ │35 - , │ │36 - .example = │ │37 - \\haxy receive-pack <directory> │ │38 - , │ │39 - }, │ │40 - .http_backend => .{ │ │41 - .name = "http-backend", │ │42 - .descrip = │ │43 - \\a CGI program forwarding receive-pack and upload-pack over HTTP.│ │44 - , │ │45 - .example = │ │46 - \\haxy http-backend │ │47 - , │ │48 - }, │ │19 .serve => .{ │ │20 .name = "serve", │ │21 .descrip = │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ │190 /// if any additional allocation needs to be done, the arena inside the cmd args will be used.│ │191 pub fn Command(comptime repo_kind: rp.RepoKind, comptime hash_kind: hash.HashKind) type { │ │192 return union(CommandKind) { │ │223 - upload_pack: struct { │ │224 - dir: []const u8, │ │225 - options: xit.net_server_upload_pack.Options, │ │226 - }, │ │227 - receive_pack: struct { │ │228 - dir: []const u8, │ │229 - options: xit.net_server_receive_pack.Options, │ │230 - }, │ │231 - http_backend, │ │193 serve: struct { │ │194 http_listen: []const u8, │ │195 ssh_listen: ?[]const u8, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │204 pub fn initMaybe(cmd_args: *CommandArgs) !?Command(repo_kind, hash_kind) { │ │205 const command_kind = cmd_args.command_kind orelse return null; │ │206 switch (command_kind) { │ │246 - .upload_pack => { │ │247 - if (cmd_args.positional_args.len != 1) return null; │ │248 - │ │249 - return .{ .upload_pack = .{ │ │250 - .dir = cmd_args.positional_args[0], │ │251 - .options = .{ │ │252 - .advertise_refs = cmd_args.contains("--http-backend-info-refs"), │ │253 - .is_stateless = cmd_args.contains("--stateless-rpc"), │ │254 - }, │ │255 - } }; │ │256 - }, │ │257 - .receive_pack => { │ │258 - if (cmd_args.positional_args.len != 1) return null; │ │259 - │ │260 - return .{ .receive_pack = .{ │ │261 - .dir = cmd_args.positional_args[0], │ │262 - .options = .{ │ │263 - .skip_connectivity_check = cmd_args.contains("--skip-connectivity-check"),│ │264 - .advertise_refs = cmd_args.contains("--http-backend-info-refs"), │ │265 - .is_stateless = cmd_args.contains("--stateless-rpc"), │ │266 - }, │ │267 - } }; │ │268 - }, │ │269 - .http_backend => { │ │270 - if (cmd_args.positional_args.len != 0) return null; │ │271 - │ │272 - return .http_backend; │ │273 - }, │ │207 .serve => { │ │208 if (cmd_args.positional_args.len != 0) return null; │ │209 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯