╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ main.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
48 } 49 50 pub fn run( 51 comptime repo_kind: rp.RepoKind, 52 comptime any_repo_opts: rp.AnyRepoOpts(repo_kind), 53 io: std.Io, 54 allocator: std.mem.Allocator, 55 args: []const []const u8, 56 cwd_path: []const u8, 57 run_opts: RunOpts, 58 ) !void { 59 var cmd_args = try cmd.CommandArgs.init(allocator, args); 60 defer cmd_args.deinit(); 61 62 switch (try cmd.CommandDispatch.init(&cmd_args)) { 63 .invalid => |invalid| switch (invalid) { 64 .command => |command| { 65 try run_opts.err.print("\"{s}\" is not a valid command\n\n", .{command}); 66 try cmd.printHelp(null, run_opts.err); 67 return error.HandledError; 68 }, 69 .argument => |argument| { 70 try run_opts.err.print("\"{s}\" is not a valid argument\n\n", .{argument.value}); 71 try cmd.printHelp(argument.command, run_opts.err); 72 return error.HandledError; 73 }, 74 }, 75 .help => |cmd_kind_maybe| try cmd.printHelp(cmd_kind_maybe, run_opts.out), 76 .cli => |cli_cmd| switch (cli_cmd) { 77 .serve => |options| try srv.run(repo_kind, any_repo_opts, io, allocator, cwd_path, options, run_opts.err, {}), 78 }, 79 } 80 } 81