diff options
| author | 2019-11-27 23:13:31 +0900 | |
|---|---|---|
| committer | 2019-11-27 23:13:31 +0900 | |
| commit | a305e818bd986c599fff17141617bc4f890276cf (patch) | |
| tree | ff0a5c133c271d83de3e71ebc023ffc08bb1e3c9 /example/comptime-clap-error.zig | |
| parent | Breaking: OsIterator will now get the exe on init (diff) | |
| download | zig-clap-a305e818bd986c599fff17141617bc4f890276cf.tar.gz zig-clap-a305e818bd986c599fff17141617bc4f890276cf.tar.xz zig-clap-a305e818bd986c599fff17141617bc4f890276cf.zip | |
Add clap.parse as the simplest way of using the lib
Diffstat (limited to '')
| -rw-r--r-- | example/comptime-clap-error.zig | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/example/comptime-clap-error.zig b/example/comptime-clap-error.zig deleted file mode 100644 index 3209b74..0000000 --- a/example/comptime-clap-error.zig +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | const std = @import("std"); | ||
| 2 | const clap = @import("clap"); | ||
| 3 | |||
| 4 | pub fn main() !void { | ||
| 5 | const allocator = std.heap.direct_allocator; | ||
| 6 | |||
| 7 | const params = [_]clap.Param(void){clap.Param(void){ | ||
| 8 | .names = clap.Names{ .short = 'h', .long = "help" }, | ||
| 9 | }}; | ||
| 10 | |||
| 11 | var iter = clap.args.OsIterator.init(allocator); | ||
| 12 | defer iter.deinit(); | ||
| 13 | const exe = try iter.next(); | ||
| 14 | |||
| 15 | var args = try clap.ComptimeClap(void, params).parse(allocator, clap.args.OsIterator, &iter); | ||
| 16 | defer args.deinit(); | ||
| 17 | |||
| 18 | _ = args.flag("--helps"); | ||
| 19 | } | ||