diff options
| author | 2020-11-10 18:53:57 +0100 | |
|---|---|---|
| committer | 2020-11-10 18:53:57 +0100 | |
| commit | b7e6ebf36e2ac4314e6bff65f1d64466ea82a18a (patch) | |
| tree | f979a760149f4c7a2d9b9113a872d8d7e6d56bef /clap/comptime.zig | |
| parent | Update ci to use 0.7.0 (diff) | |
| download | zig-clap-0.3.0.tar.gz zig-clap-0.3.0.tar.xz zig-clap-0.3.0.zip | |
Deprecate ComptimeClap in favor of parseExv0.3.0
Diffstat (limited to 'clap/comptime.zig')
| -rw-r--r-- | clap/comptime.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clap/comptime.zig b/clap/comptime.zig index 80eb428..8ab61cb 100644 --- a/clap/comptime.zig +++ b/clap/comptime.zig | |||
| @@ -6,9 +6,9 @@ const heap = std.heap; | |||
| 6 | const mem = std.mem; | 6 | const mem = std.mem; |
| 7 | const debug = std.debug; | 7 | const debug = std.debug; |
| 8 | 8 | ||
| 9 | /// Deprecated: Use `parseEx` instead | ||
| 9 | pub fn ComptimeClap( | 10 | pub fn ComptimeClap( |
| 10 | comptime Id: type, | 11 | comptime Id: type, |
| 11 | comptime ArgIter: type, | ||
| 12 | comptime params: []const clap.Param(Id), | 12 | comptime params: []const clap.Param(Id), |
| 13 | ) type { | 13 | ) type { |
| 14 | var flags: usize = 0; | 14 | var flags: usize = 0; |
| @@ -42,7 +42,7 @@ pub fn ComptimeClap( | |||
| 42 | pos: []const []const u8, | 42 | pos: []const []const u8, |
| 43 | allocator: *mem.Allocator, | 43 | allocator: *mem.Allocator, |
| 44 | 44 | ||
| 45 | pub fn parse(allocator: *mem.Allocator, iter: *ArgIter, diag: ?*clap.Diagnostic) !@This() { | 45 | pub fn parse(allocator: *mem.Allocator, iter: anytype, diag: ?*clap.Diagnostic) !@This() { |
| 46 | var multis = [_]std.ArrayList([]const u8){undefined} ** multi_options; | 46 | var multis = [_]std.ArrayList([]const u8){undefined} ** multi_options; |
| 47 | for (multis) |*multi| { | 47 | for (multis) |*multi| { |
| 48 | multi.* = std.ArrayList([]const u8).init(allocator); | 48 | multi.* = std.ArrayList([]const u8).init(allocator); |
| @@ -58,7 +58,7 @@ pub fn ComptimeClap( | |||
| 58 | .allocator = allocator, | 58 | .allocator = allocator, |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | var stream = clap.StreamingClap(usize, ArgIter){ | 61 | var stream = clap.StreamingClap(usize, @typeInfo(@TypeOf(iter)).Pointer.child){ |
| 62 | .params = converted_params, | 62 | .params = converted_params, |
| 63 | .iter = iter, | 63 | .iter = iter, |
| 64 | }; | 64 | }; |
| @@ -147,7 +147,7 @@ pub fn ComptimeClap( | |||
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | test "" { | 149 | test "" { |
| 150 | const Clap = ComptimeClap(clap.Help, clap.args.SliceIterator, comptime &[_]clap.Param(clap.Help){ | 150 | const Clap = ComptimeClap(clap.Help, comptime &[_]clap.Param(clap.Help){ |
| 151 | clap.parseParam("-a, --aa ") catch unreachable, | 151 | clap.parseParam("-a, --aa ") catch unreachable, |
| 152 | clap.parseParam("-b, --bb ") catch unreachable, | 152 | clap.parseParam("-b, --bb ") catch unreachable, |
| 153 | clap.parseParam("-c, --cc <V>") catch unreachable, | 153 | clap.parseParam("-c, --cc <V>") catch unreachable, |