╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ command.zig ──────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
232 .value = cmd_args.unused_args.keys()[0], 233 }, 234 }, 235 }; 236 } 237 return dispatch; 238 } 239 240 pub fn initIgnoreUnused(cmd_args: *CommandArgs) !CommandDispatch { 241 const show_help = cmd_args.contains("--help"); 242 243 if (cmd_args.command_kind) |command_kind| { 244 if (show_help) { 245 return .{ .help = command_kind }; 246 } else if (try Command.initMaybe(cmd_args)) |cmd| { 247 return .{ .cli = cmd }; 248 } else { 249 return .{ .help = command_kind }; 250 } 251 } else if (cmd_args.command_name) |command_name| { 252 return .{ .invalid = .{ .command = command_name } }; 253 } else if (show_help) { 254 return .{ .help = null }; 255 } else { 256 return .{ .help = null }; 257 } 258 } 259 }; 260