Skip to content

Commit

Permalink
fix positional validation
Browse files Browse the repository at this point in the history
  • Loading branch information
n0s4 committed Aug 14, 2024
1 parent 6835659 commit 70b7068
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/meta.zig
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ pub fn info(comptime Flags: type) FlagsInfo {

var seen_optional = false;
for (@typeInfo(field.type).Struct.fields) |positional| {
if (@typeInfo(positional.type) == .Optional) {
if (@typeInfo(positional.type) != .Optional) {
if (seen_optional) compileError(
"non-optional positional field after optional: {s}",
.{positional.name},
) else {
seen_optional = true;
}
);
} else {
seen_optional = true;
}
command.positionals = command.positionals ++ .{Positional{
.type = positional.type,
Expand Down

0 comments on commit 70b7068

Please sign in to comment.