diff options
| author | 2020-08-28 16:19:20 +1000 | |
|---|---|---|
| committer | 2020-08-28 09:43:42 +0200 | |
| commit | 8813e8783223b4ff0afd28856f760a3d3199a39e (patch) | |
| tree | 64fca0c53e4ccf35572c6e893351c06aad20f275 /clap | |
| parent | fix up (diff) | |
| download | zig-clap-8813e8783223b4ff0afd28856f760a3d3199a39e.tar.gz zig-clap-8813e8783223b4ff0afd28856f760a3d3199a39e.tar.xz zig-clap-8813e8783223b4ff0afd28856f760a3d3199a39e.zip | |
reverse the order of these
Diffstat (limited to 'clap')
| -rw-r--r-- | clap/comptime.zig | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/clap/comptime.zig b/clap/comptime.zig index 99f0be6..b0edb2a 100644 --- a/clap/comptime.zig +++ b/clap/comptime.zig | |||
| @@ -100,23 +100,23 @@ pub fn ComptimeClap(comptime Id: type, comptime params: []const clap.Param(Id)) | |||
| 100 | return parser.flags[param.id]; | 100 | return parser.flags[param.id]; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | pub fn options(parser: @This(), comptime name: []const u8) []const []const u8 { | 103 | pub fn option(parser: @This(), comptime name: []const u8) ?[]const u8 { |
| 104 | const param = comptime findParam(name); | 104 | const param = comptime findParam(name); |
| 105 | if (param.takes_value == .None) | 105 | if (param.takes_value == .None) |
| 106 | @compileError(name ++ " is a flag and not an option."); | 106 | @compileError(name ++ " is a flag and not an option."); |
| 107 | if (param.takes_value == .One) | 107 | if (param.takes_value == .Many) |
| 108 | @compileError(name ++ " takes one option, not multiple."); | 108 | @compileError(name ++ " takes many options, not one."); |
| 109 | 109 | return parser.single_options[param.id]; | |
| 110 | return parser.multi_options[param.id]; | ||
| 111 | } | 110 | } |
| 112 | 111 | ||
| 113 | pub fn option(parser: @This(), comptime name: []const u8) ?[]const u8 { | 112 | pub fn options(parser: @This(), comptime name: []const u8) []const []const u8 { |
| 114 | const param = comptime findParam(name); | 113 | const param = comptime findParam(name); |
| 115 | if (param.takes_value == .None) | 114 | if (param.takes_value == .None) |
| 116 | @compileError(name ++ " is a flag and not an option."); | 115 | @compileError(name ++ " is a flag and not an option."); |
| 117 | if (param.takes_value == .Many) | 116 | if (param.takes_value == .One) |
| 118 | @compileError(name ++ " takes many options, not one."); | 117 | @compileError(name ++ " takes one option, not multiple."); |
| 119 | return parser.single_options[param.id]; | 118 | |
| 119 | return parser.multi_options[param.id]; | ||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | pub fn positionals(parser: @This()) []const []const u8 { | 122 | pub fn positionals(parser: @This()) []const []const u8 { |