feat(comma): Added enum value for unknown commands.

This commit is contained in:
2026-04-21 18:05:02 -04:00
parent bd2a5455af
commit ae4454596a
3 changed files with 28 additions and 15 deletions

View File

@@ -11,16 +11,18 @@ pub const root: Command = .new(.{
.{
.name = "deps",
.short = "Check for missing binaries",
.long = \\envr relies on external binaries for certain functionality.
\\
\\ The deps command reports which binaries are available and which are not.",
.long =
\\envr relies on external binaries for certain functionality.
\\
\\ The deps command reports which binaries are available and which are not."
,
},
.{ .name = "version" },
},
});
test "enum type" {
const got: root.Type = @enumFromInt(1);
const got: root.Type = @enumFromInt(2);
try std.testing.expectEqual(.version, got);
}
@@ -31,3 +33,10 @@ test "parse version" {
try std.testing.expectEqual(.version, cmd);
}
test "parse unknown" {
const args = &[_][]const u8{"bad", "value"};
const cmd = root.parse(args);
try std.testing.expectEqual(.unknown, cmd);
}