diff options
| author | 2018-11-13 13:33:51 +0100 | |
|---|---|---|
| committer | 2018-11-13 13:33:51 +0100 | |
| commit | 9e2ac9c6ab567ab3d95db9527147ef80aa4dd7c1 (patch) | |
| tree | aaba4173edfbc925068393c1d417da2b618bea53 /clap.zig | |
| parent | Run tests in all release modes (diff) | |
| download | zig-clap-9e2ac9c6ab567ab3d95db9527147ef80aa4dd7c1.tar.gz zig-clap-9e2ac9c6ab567ab3d95db9527147ef80aa4dd7c1.tar.xz zig-clap-9e2ac9c6ab567ab3d95db9527147ef80aa4dd7c1.zip | |
Zig fmt
Diffstat (limited to 'clap.zig')
| -rw-r--r-- | clap.zig | 25 |
1 files changed, 1 insertions, 24 deletions
| @@ -210,7 +210,7 @@ pub const OsArgIterator = struct { | |||
| 210 | /// ::StreamingClap.next to parse all the arguments of your program. | 210 | /// ::StreamingClap.next to parse all the arguments of your program. |
| 211 | pub fn StreamingClap(comptime Id: type, comptime ArgError: type) type { | 211 | pub fn StreamingClap(comptime Id: type, comptime ArgError: type) type { |
| 212 | return struct { | 212 | return struct { |
| 213 | const Self = @This(); | 213 | const Self = @This(); |
| 214 | 214 | ||
| 215 | const State = union(enum) { | 215 | const State = union(enum) { |
| 216 | Normal, | 216 | Normal, |
| @@ -374,26 +374,3 @@ pub fn StreamingClap(comptime Id: type, comptime ArgError: type) type { | |||
| 374 | } | 374 | } |
| 375 | }; | 375 | }; |
| 376 | } | 376 | } |
| 377 | |||
| 378 | pub fn ToStructId(comptime T: type) type { | ||
| 379 | return struct { | ||
| 380 | parse: fn(*T, ?[]const u8) | ||
| 381 | }; | ||
| 382 | } | ||
| 383 | |||
| 384 | const ToStructParamError = error{}; | ||
| 385 | const ToStructParam = Param(fn (*T, ?[]const u8) ToStructParamError!void); | ||
| 386 | |||
| 387 | fn paramsFromStruct(comptime T: type) []const ToStructParam { | ||
| 388 | var res: []const ToStructParam = []ToStructParam{}; | ||
| 389 | |||
| 390 | for (@typeInfo(T).Struct.fields) |field| { | ||
| 391 | res = res ++ []ToStructParam{ | ||
| 392 | ToStructParam.init() | ||
| 393 | }; | ||
| 394 | } | ||
| 395 | } | ||
| 396 | |||
| 397 | pub fn toStruct(defaults: var, iter: *ArgIterator(ArgError)) !@typeOf(defaults) { | ||
| 398 | |||
| 399 | } | ||