From 9c8af684933070270a0abfba673d5ba5cbc5f983 Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Mon, 17 Sep 2018 14:24:41 +0200 Subject: Renamed Clap to StreamingClap --- clap.zig | 10 +++++----- test.zig | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clap.zig b/clap.zig index 6c21dba..06c860e 100644 --- a/clap.zig +++ b/clap.zig @@ -116,7 +116,7 @@ pub fn Param(comptime Id: type) type { }; } -/// The result returned from ::Clap.next +/// The result returned from ::StreamingClap.next pub fn Arg(comptime Id: type) type { return struct { const Self = @This(); @@ -206,9 +206,9 @@ pub const OsArgIterator = struct { }; /// A command line argument parser which, given an ::ArgIterator, will parse arguments according -/// to the ::params. ::Clap parses in an iterating manner, so you have to use a loop together with -/// ::Clap.next to parse all the arguments of your program. -pub fn Clap(comptime Id: type, comptime ArgError: type) type { +/// to the ::params. ::StreamingClap parses in an iterating manner, so you have to use a loop together with +/// ::StreamingClap.next to parse all the arguments of your program. +pub fn StreamingClap(comptime Id: type, comptime ArgError: type) type { return struct { const Self = @This(); @@ -373,4 +373,4 @@ pub fn Clap(comptime Id: type, comptime ArgError: type) type { return error.InvalidArgument; } }; -} +} \ No newline at end of file diff --git a/test.zig b/test.zig index c42fbb9..70bbab1 100644 --- a/test.zig +++ b/test.zig @@ -9,12 +9,12 @@ const assert = debug.assert; const ArgSliceIterator = clap.ArgSliceIterator; const Names = clap.Names; const Param = clap.Param(u8); -const Clap = clap.Clap(u8, ArgSliceIterator.Error); +const StreamingClap = clap.StreamingClap(u8, ArgSliceIterator.Error); const Arg = clap.Arg(u8); fn testNoErr(params: []const Param, args: []const []const u8, results: []const Arg) void { var arg_iter = ArgSliceIterator.init(args); - var c = Clap.init(params, &arg_iter.iter); + var c = StreamingClap.init(params, &arg_iter.iter); for (results) |res| { const arg = (c.next() catch unreachable) orelse unreachable; @@ -224,7 +224,7 @@ test "clap.Example" { // a slice of arguments. For real program, you would probably // use `OsArgIterator`. var iter = &c.ArgSliceIterator.init(program_args).iter; - var parser = c.Clap(u8, c.ArgSliceIterator.Error).init(params, iter); + var parser = c.StreamingClap(u8, c.ArgSliceIterator.Error).init(params, iter); // Iterate over all arguments passed to the program. // In real code, you should probably handle the errors -- cgit v1.2.3