Closed Hejsil closed 6 years ago
Currently, this does not work:
const SubOptions = struct { b: u64, }; const Options = struct { a: SubOptions, }; const parser = comptime Clap(Options).Builder .init( Options { .a = SubOptions { .b = 0 } } ) .command( Command.Builder .init("command") .arguments( []Argument { Argument.Builder .init("a.b") .help("Set the 'b' field of Option.") .short('b') .takesValue(true) .build(), } ) .build() ) .build();
zig-clap/clap.zig:193:13: error: Field not found! @compileError("Field not found!"); ^ zig-clap/clap.zig:196:89: note: called from here fn getFieldPtr(comptime T: type, res: &T, comptime field: []const u8) &FieldType(T, field) { ^ zig-clap/clap.zig:196:79: note: called from here fn getFieldPtr(comptime T: type, res: &T, comptime field: []const u8) &FieldType(T, field) { ^ zig-clap/clap.zig:144:111: error: unable to evaluate constant expression *getFieldPtr(Result, &result, option.field) = try strToValue(FieldType(Result, option.field), value); ^ zig-clap/clap.zig:23:32: note: called from here return parseCommand(CommandList { .command = clap.command, .prev = null }, clap.defaults, arguments); ^ zig-clap/sample.zig:49:37: note: called from here const options = try parser.parse(args[1..]);
Also, the error message should probably be better.
Currently, this does not work:
Also, the error message should probably be better.