diff options
| author | 2018-06-01 13:37:40 +0200 | |
|---|---|---|
| committer | 2018-06-01 13:37:40 +0200 | |
| commit | 5c7016f2bc10c0f964fce5c4d9e7210db5786da7 (patch) | |
| tree | cae5744c1c76480ccdf957c1e60269bbf92d98b9 /src/core.zig | |
| parent | The arg iterator is now responsible for allocation instead of core.Clap (diff) | |
| download | zig-clap-5c7016f2bc10c0f964fce5c4d9e7210db5786da7.tar.gz zig-clap-5c7016f2bc10c0f964fce5c4d9e7210db5786da7.tar.xz zig-clap-5c7016f2bc10c0f964fce5c4d9e7210db5786da7.zip | |
Reworked extended.zig again!
Diffstat (limited to 'src/core.zig')
| -rw-r--r-- | src/core.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core.zig b/src/core.zig index 5e47714..f2e1fe0 100644 --- a/src/core.zig +++ b/src/core.zig | |||
| @@ -266,8 +266,10 @@ pub fn Clap(comptime Id: type, comptime ArgError: type) type { | |||
| 266 | kind = ArgInfo.Kind.Short; | 266 | kind = ArgInfo.Kind.Short; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | if (arg.len == 0) | 269 | // We allow long arguments to go without a name. |
| 270 | return error.ArgWithNoName; | 270 | // This allows the user to use "--" for something important |
| 271 | if (kind != ArgInfo.Kind.Long and arg.len == 0) | ||
| 272 | return error.InvalidArgument; | ||
| 271 | 273 | ||
| 272 | break :blk ArgInfo { .arg = arg, .kind = kind }; | 274 | break :blk ArgInfo { .arg = arg, .kind = kind }; |
| 273 | }; | 275 | }; |