Closed tealsnow closed 2 years ago
The ability to specify an enum as a possible values parser for an option.
const MyEnum = enum { foo, bar, }; const params = comptime clap.parseParamsComptime( \\-E, --my_enum <MyEnum> ); const parsers = comptime .{ .MyEnum = clap.parsers.enumParser(MyEnum), }; var res = clap.parse(clap.Help, ¶ms, parsers, .{}) catch unreachable; defer res.deinit(); if (res.args.my_enum) |e| { const my_enum: MyEnum = e; } // usage: // --my_enum foo --my_enum=bar // -Efoo -E bar
The ability to specify an enum as a possible values parser for an option.