diff options
| author | 2021-05-26 21:06:10 +0200 | |
|---|---|---|
| committer | 2021-05-26 21:06:10 +0200 | |
| commit | c7d83fcce1739271e399260b50c5f68aa03c5908 (patch) | |
| tree | f859d081955e5c8c3bc329008837d351606ec19c /README.md | |
| parent | Merge branch 'master' into zig-master (diff) | |
| download | zig-clap-c7d83fcce1739271e399260b50c5f68aa03c5908.tar.gz zig-clap-c7d83fcce1739271e399260b50c5f68aa03c5908.tar.xz zig-clap-c7d83fcce1739271e399260b50c5f68aa03c5908.zip | |
Update to latest zig in preperation for 0.8.0
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 16 |
1 files changed, 8 insertions, 8 deletions
| @@ -55,11 +55,11 @@ pub fn main() !void { | |||
| 55 | if (args.flag("--help")) | 55 | if (args.flag("--help")) |
| 56 | debug.warn("--help\n", .{}); | 56 | debug.warn("--help\n", .{}); |
| 57 | if (args.option("--number")) |n| | 57 | if (args.option("--number")) |n| |
| 58 | debug.warn("--number = {}\n", .{n}); | 58 | debug.warn("--number = {s}\n", .{n}); |
| 59 | for (args.options("--string")) |s| | 59 | for (args.options("--string")) |s| |
| 60 | debug.warn("--string = {}\n", .{s}); | 60 | debug.warn("--string = {s}\n", .{s}); |
| 61 | for (args.positionals()) |pos| | 61 | for (args.positionals()) |pos| |
| 62 | debug.warn("{}\n", .{pos}); | 62 | debug.warn("{s}\n", .{pos}); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | ``` | 65 | ``` |
| @@ -154,12 +154,12 @@ pub fn main() !void { | |||
| 154 | // arg.param will point to the parameter which matched the argument. | 154 | // arg.param will point to the parameter which matched the argument. |
| 155 | switch (arg.param.id) { | 155 | switch (arg.param.id) { |
| 156 | 'h' => debug.warn("Help!\n", .{}), | 156 | 'h' => debug.warn("Help!\n", .{}), |
| 157 | 'n' => debug.warn("--number = {}\n", .{arg.value.?}), | 157 | 'n' => debug.warn("--number = {s}\n", .{arg.value.?}), |
| 158 | 158 | ||
| 159 | // arg.value == null, if arg.param.takes_value == false. | 159 | // arg.value == null, if arg.param.takes_value == .none. |
| 160 | // Otherwise, arg.value is the value passed with the argument, such as "-a=10" | 160 | // Otherwise, arg.value is the value passed with the argument, such as "-a=10" |
| 161 | // or "-a 10". | 161 | // or "-a 10". |
| 162 | 'f' => debug.warn("{}\n", .{arg.value.?}), | 162 | 'f' => debug.warn("{s}\n", .{arg.value.?}), |
| 163 | else => unreachable, | 163 | else => unreachable, |
| 164 | } | 164 | } |
| 165 | } | 165 | } |
| @@ -185,7 +185,7 @@ pub fn main() !void { | |||
| 185 | // help message for any Param, but it is more verbose to call. | 185 | // help message for any Param, but it is more verbose to call. |
| 186 | try clap.help( | 186 | try clap.help( |
| 187 | std.io.getStdErr().writer(), | 187 | std.io.getStdErr().writer(), |
| 188 | comptime &[_]clap.Param(clap.Help){ | 188 | comptime &.{ |
| 189 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, | 189 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, |
| 190 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, | 190 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, |
| 191 | }, | 191 | }, |
| @@ -223,7 +223,7 @@ pub fn main() !void { | |||
| 223 | // usage message for any Param, but it is more verbose to call. | 223 | // usage message for any Param, but it is more verbose to call. |
| 224 | try clap.usage( | 224 | try clap.usage( |
| 225 | std.io.getStdErr().writer(), | 225 | std.io.getStdErr().writer(), |
| 226 | comptime &[_]clap.Param(clap.Help){ | 226 | comptime &.{ |
| 227 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, | 227 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, |
| 228 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, | 228 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, |
| 229 | clap.parseParam(" --value <N> Output version information and exit.") catch unreachable, | 229 | clap.parseParam(" --value <N> Output version information and exit.") catch unreachable, |