diff --git a/src/Config.zig b/src/Config.zig index ddffb052..c5606135 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -101,8 +101,8 @@ const Commands = cli.Builder(.{ .{ .name = "serve", .options = .{ - .{ .name = "host", .shortcuts = .{ "h", "H" }, .type = []const u8, .default = "127.0.0.1" }, - .{ .name = "port", .shortcuts = .{ "p", "P" }, .type = u16, .default = 9222 }, + .{ .name = "host", .type = []const u8, .default = "127.0.0.1" }, + .{ .name = "port", .type = u16, .default = 9222 }, .{ .name = "advertise_host", .type = ?[]const u8 }, .{ .name = "timeout", .type = u31, .default = 10 }, .{ .name = "cdp_max_connections", .type = u16, .default = 16 }, @@ -112,11 +112,10 @@ const Commands = cli.Builder(.{ }, .{ .name = "fetch", - .aliases = .{ "f", "get" }, // This argument can be given out of order. .positional = .{ .name = "url", .type = ?[:0]const u8 }, .options = .{ - .{ .name = "dump", .shortcuts = .{ "d", "D" }, .type = ?DumpFormat, .validator = dumpValidator }, + .{ .name = "dump", .type = ?DumpFormat, .validator = dumpValidator }, .{ .name = "with_base", .type = bool }, .{ .name = "with_frames", .type = bool }, .{ .name = "strip", .type = dump.Opts.Strip, .default = dump.Opts.Strip{} }, @@ -134,8 +133,8 @@ const Commands = cli.Builder(.{ }, .shared_options = CommonOptions, }, - .{ .name = "version", .aliases = .{"v"}, .options = .{} }, - .{ .name = "help", .aliases = .{ "h", "?" }, .options = .{} }, + .{ .name = "version", .options = .{} }, + .{ .name = "help", .options = .{} }, }); pub const RunMode = Commands.Enum; diff --git a/src/cli.zig b/src/cli.zig index 1170d07f..66912387 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -263,19 +263,9 @@ pub fn Builder(comptime commands: anytype) type { const cmd_str: []const u8 = args.next() orelse return error.MissingCommand; inline for (commands) |command| { - // Command name together with it's aliases. - const with_aliases = blk: { - if (@hasField(@TypeOf(command), "aliases")) { - break :blk command.aliases ++ .{command.name}; - } - - break :blk .{command.name}; - }; - - inline for (with_aliases) |name| { - if (std.mem.eql(u8, cmd_str, name)) { - return .{ exec_name, try parseCommand(allocator, command, &args) }; - } + // Match a command. + if (std.mem.eql(u8, cmd_str, command.name)) { + return .{ exec_name, try parseCommand(allocator, command, &args) }; } } @@ -369,18 +359,6 @@ pub fn Builder(comptime commands: anytype) type { const match = std.mem.eql(u8, option_name, "--" ++ option.name) or std.mem.eql(u8, option_name, "--" ++ kebab_cased); - - // Name not matched; try shortcuts if provided. - if (!match) { - if (@hasField(@TypeOf(option), "shortcuts")) { - inline for (option.shortcuts) |shortcut| { - if (std.mem.eql(u8, option_name, "-" ++ shortcut)) { - break :blk true; - } - } - } - } - break :blk match; };