From 9db6e56d1603a5fe738516b10a3b15b9209e4680 Mon Sep 17 00:00:00 2001 From: Komari Spaghetti Date: Thu, 24 Jun 2021 17:22:33 +0200 Subject: Stay under 100 chars per line in all the code --- clap/streaming.zig | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'clap/streaming.zig') diff --git a/clap/streaming.zig b/clap/streaming.zig index e2f1311..885c581 100644 --- a/clap/streaming.zig +++ b/clap/streaming.zig @@ -21,8 +21,8 @@ pub fn Arg(comptime Id: type) type { } /// A command line argument parser which, given an ArgIterator, will parse arguments according -/// 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. +/// 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 ArgIterator: type) type { return struct { const State = union(enum) { @@ -203,7 +203,11 @@ pub fn StreamingClap(comptime Id: type, comptime ArgIterator: type) type { }; } -fn testNoErr(params: []const clap.Param(u8), args_strings: []const []const u8, results: []const Arg(u8)) !void { +fn testNoErr( + params: []const clap.Param(u8), + args_strings: []const []const u8, + results: []const Arg(u8), +) !void { var iter = args.SliceIterator{ .args = args_strings }; var c = StreamingClap(u8, args.SliceIterator){ .params = params, @@ -225,7 +229,11 @@ fn testNoErr(params: []const clap.Param(u8), args_strings: []const []const u8, r return error.TestFailed; } -fn testErr(params: []const clap.Param(u8), args_strings: []const []const u8, expected: []const u8) !void { +fn testErr( + params: []const clap.Param(u8), + args_strings: []const []const u8, + expected: []const u8, +) !void { var diag: clap.Diagnostic = undefined; var iter = args.SliceIterator{ .args = args_strings }; var c = StreamingClap(u8, args.SliceIterator){ @@ -420,5 +428,9 @@ test "errors" { try testErr(¶ms, &.{"-a=1"}, "The argument '-a' does not take a value\n"); try testErr(¶ms, &.{"--aa=1"}, "The argument '--aa' does not take a value\n"); try testErr(¶ms, &.{"-c"}, "The argument '-c' requires a value but none was supplied\n"); - try testErr(¶ms, &.{"--cc"}, "The argument '--cc' requires a value but none was supplied\n"); + try testErr( + ¶ms, + &.{"--cc"}, + "The argument '--cc' requires a value but none was supplied\n", + ); } -- cgit v1.2.3