diff options
| author | 2026-02-14 18:19:39 +0100 | |
|---|---|---|
| committer | 2026-02-14 18:20:29 +0100 | |
| commit | 27621cb7207643f914bae7b01902b22a8b5916e7 (patch) | |
| tree | 364101291469a91343b990072db70ebcc4ed0dd9 /clap.zig | |
| parent | fix: use new `std.process.Init` args for Zig `0.16.0-dev.2261+d6b3dd25a` (#175) (diff) | |
| download | zig-clap-27621cb7207643f914bae7b01902b22a8b5916e7.tar.gz zig-clap-27621cb7207643f914bae7b01902b22a8b5916e7.tar.xz zig-clap-27621cb7207643f914bae7b01902b22a8b5916e7.zip | |
See https://github.com/Hejsil/zig-clap/issues/153
Diffstat (limited to 'clap.zig')
| -rw-r--r-- | clap.zig | 18 |
1 files changed, 18 insertions, 0 deletions
| @@ -899,6 +899,24 @@ fn Positionals( | |||
| 899 | if (longest.kind != .positional) | 899 | if (longest.kind != .positional) |
| 900 | continue; | 900 | continue; |
| 901 | 901 | ||
| 902 | if ((i + 1) != fields_len and param.takes_value == .many) { | ||
| 903 | @compileError( | ||
| 904 | \\Only the last positional is allowed to take multiple values | ||
| 905 | \\This works: | ||
| 906 | \\ <usize> | ||
| 907 | \\ <str> | ||
| 908 | \\ <str>... | ||
| 909 | \\ | ||
| 910 | \\This doesn't: | ||
| 911 | \\ <usize> | ||
| 912 | \\ <str>... | ||
| 913 | \\ <str> | ||
| 914 | \\ | ||
| 915 | \\See https://github.com/Hejsil/zig-clap/issues/153 | ||
| 916 | \\ | ||
| 917 | ); | ||
| 918 | } | ||
| 919 | |||
| 902 | const T = ParamType(Id, param, value_parsers); | 920 | const T = ParamType(Id, param, value_parsers); |
| 903 | const FieldT = switch (param.takes_value) { | 921 | const FieldT = switch (param.takes_value) { |
| 904 | .none => continue, | 922 | .none => continue, |