Support for more complex parameters
- Dominant language
- Zig
- Stars
- 1.6k
- Forks
- 99
- Avg merge
- 3h 53m
- Merged PRs (30d)
- 1
Description
I'd like to parse something like `--mode x[@Hz]`.
To my from my current understanding this is not possible.
I intended to write it as follows:
```zig
const params = comptime [_]clap.Param(clap.Help) {
.{
.id = .{.msg = "defines the output mode", .value = "x[@Hz]"},
.names = .{ .short = 'm', .long = "mode" },
.takes_value = .One,
},
};
var args = try clap.parse(clap.Help, ¶ms, std.heap.page_allocator, null);
defer args.deinit();
if (args.option("--mode")) |n| {
// Parse width,height and refresh manually
}
```
This would work but is to some extend a hack. The main problem with this is that all `help*` functions become useless because they put `<>` around the value string.
A simple fix would be to make the formatting in `parseParam` accept a custom formatstring. But I am not sure that this is the right solution.
When this usecase is considered valid then I'll spend some time thinking about a good solution.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.