help: implement subcommand descriptions
I believe we've produced a superset of the functionality that was present before rewriting all of the code. There are still a lot of fiddly little details that need to be thought through in order to produce something that is righteously flexible, but I think this is in reasonable shape to start inventing real-world uses for it. Adding some tests, cleaning up a little bit of the allocation handling (make better use of the arena allocators—we are definitely sort of leaking memory at the moment), and writing documentation are still on the roadmap.
This commit is contained in:
@@ -9,7 +9,7 @@ const cli = cmd: {
|
||||
var cmd = CommandBuilder(u32).init(
|
||||
\\The definitive noclip demonstration utility
|
||||
\\
|
||||
\\This command demonstrates the functionality of the noclip library. cool!!
|
||||
\\This command demonstrates the functionality of the noclip library. cool!
|
||||
);
|
||||
cmd.add_option(.{ .OutputType = struct { u8, u8 } }, .{
|
||||
.name = "test",
|
||||
@@ -41,7 +41,6 @@ const cli = cmd: {
|
||||
.name = "multi",
|
||||
.short_tag = "-m",
|
||||
.long_tag = "--multi",
|
||||
.env_var = "NOCLIP_MULTI",
|
||||
.description = "multiple specification test option",
|
||||
});
|
||||
cmd.add_flag(.{}, .{
|
||||
@@ -54,11 +53,16 @@ const cli = cmd: {
|
||||
cmd.add_flag(.{ .multi = true }, .{
|
||||
.name = "multiflag",
|
||||
.truthy = .{ .short_tag = "-M" },
|
||||
.env_var = "NOCLIP_MULTIFLAG",
|
||||
.description = "multiple specification test flag ",
|
||||
});
|
||||
cmd.add_option(.{ .OutputType = u8 }, .{
|
||||
.name = "env",
|
||||
.env_var = "NOCLIP_ENVIRON",
|
||||
.description = "environment variable only option",
|
||||
});
|
||||
cmd.add_argument(.{ .OutputType = []const u8 }, .{
|
||||
.name = "arg",
|
||||
.description = "This is an argument that doesn't really do anything, but it's very important.",
|
||||
});
|
||||
|
||||
break :cmd cmd;
|
||||
|
Reference in New Issue
Block a user