Hejsil / zig-clap

Command line argument parsing library
MIT License
939 stars 67 forks source link

zig-clap doesn't build with zig 0.9.1 #77

Closed pepijno closed 2 years ago

pepijno commented 2 years ago

Taking a checkout of master (commit ac5f465) and running zig build results in the following error:

./clap.zig:913:19: error: default_value of field 'help' is of type '*const bool', expected 'bool' or '?bool'
    return @Type(.{ .Struct = .{
                  ^
./clap.zig:680:24: note: called from here
        args: Arguments(Id, params, value_parsers, .slice),
                       ^
./clap.zig:680:24: note: called from here
        args: Arguments(Id, params, value_parsers, .slice),

zig version is 0.9.1. Running zig build test has the following errors:

./clap.zig:913:19: error: default_value of field 'str' is of type '*const ?[]const u8', expected '?[]const u8' or '??[]const u8'
    return @Type(.{ .Struct = .{
                  ^
./clap.zig:812:24: note: called from here
        args: Arguments(Id, params, value_parsers, .slice),
                       ^
./clap.zig:812:24: note: called from here
        args: Arguments(Id, params, value_parsers, .slice),
                       ^
./clap.zig:913:19: error: default_value of field 'aa' is of type '*const bool', expected 'bool' or '?bool'
    return @Type(.{ .Struct = .{
                  ^
./clap.zig:812:24: note: called from here
        args: Arguments(Id, params, value_parsers, .slice),
                       ^
./clap.zig:812:24: note: called from here
        args: Arguments(Id, params, value_parsers, .slice),
                       ^
./clap.zig:913:19: error: default_value of field 'aa' is of type '*const bool', expected 'bool' or '?bool'
    return @Type(.{ .Struct = .{
                  ^
./clap.zig:812:24: note: called from here
        args: Arguments(Id, params, value_parsers, .slice),
                       ^
./clap.zig:812:24: note: called from here
        args: Arguments(Id, params, value_parsers, .slice),
Hejsil commented 2 years ago

Hi. The master branch of zig-clap targets zig master. The tagged releases of clap target tagged releases of zig

tealsnow commented 2 years ago

The master branch of zig-clap targets zig master

Would it be a good idea to make this clear in the readme?

rrthomas commented 2 years ago

Would it be a good idea to make this clear in the readme?

Similarly it would be good to know what I should do for 0.9.1; there's no 0.9.x tag, so I guessed the latest smaller tag (0.5.0), which seems to build OK—but now I have no idea how to install the library. I guess this isn't a zig-clap-specific question, but being new to zig, I'm a bit lost where to start, and zig build install --verbose suggests that no installation is actually being done!

Thanks for zig-clap! I looked at zig a while ago and found no command-line parser, and so gave up, as that's central to the sort of programs I write; it's good to see that now there is good support.

Hejsil commented 2 years ago

The master branch of zig-clap targets zig master

Would it be a good idea to make this clear in the readme?

Yes, this makes sense. I'll add a little note.

Similarly it would be good to know what I should do for 0.9.1; there's no 0.9.x tag, so I guessed the latest smaller tag (0.5.0), which seems to build OK—but now I have no idea how to install the library. I guess this isn't a zig-clap-specific question, but being new to zig, I'm a bit lost where to start, and zig build install --verbose suggests that no installation is actually being done!

Each release of zig-clap specifies on the release notes which version it targets, though everyone might not look there, so I'll also add to the readme that each release of clap targets a release of zig.

As for install. A similar question has been asked here.

rrthomas commented 2 years ago

Thanks very much for taking the time to give detailed answers to this newbie!