| ... | @@ -85,6 +85,7 @@ pub fn addOption(self: *OptionsStep, comptime T: type, name: []const u8, value: | ... | @@ -85,6 +85,7 @@ pub fn addOption(self: *OptionsStep, comptime T: type, name: []const u8, value: |
| 85 | value.minor, | 85 | value.minor, |
| 86 | value.patch, | 86 | value.patch, |
| 87 | }) catch unreachable; | 87 | }) catch unreachable; |
| | 88 | return; |
| 88 | }, | 89 | }, |
| 89 | std.SemanticVersion => { | 90 | std.SemanticVersion => { |
| 90 | out.print( | 91 | out.print( |
| ... | @@ -239,6 +240,7 @@ test "OptionsStep" { | ... | @@ -239,6 +240,7 @@ test "OptionsStep" { |
| 239 | options.addOption(?usize, "option2", null); | 240 | options.addOption(?usize, "option2", null); |
| 240 | options.addOption([]const u8, "string", "zigisthebest"); | 241 | options.addOption([]const u8, "string", "zigisthebest"); |
| 241 | options.addOption(?[]const u8, "optional_string", null); | 242 | options.addOption(?[]const u8, "optional_string", null); |
| | 243 | options.addOption(std.builtin.Version, "version", try std.builtin.Version.parse("0.1.2")); |
| 242 | options.addOption(std.SemanticVersion, "semantic_version", try std.SemanticVersion.parse("0.1.2-foo+bar")); | 244 | options.addOption(std.SemanticVersion, "semantic_version", try std.SemanticVersion.parse("0.1.2-foo+bar")); |
| 243 | | 245 | |
| 244 | try std.testing.expectEqualStrings( | 246 | try std.testing.expectEqualStrings( |
| ... | @@ -246,6 +248,11 @@ test "OptionsStep" { | ... | @@ -246,6 +248,11 @@ test "OptionsStep" { |
| 246 | \\pub const option2: ?usize = null; | 248 | \\pub const option2: ?usize = null; |
| 247 | \\pub const string: []const u8 = "zigisthebest"; | 249 | \\pub const string: []const u8 = "zigisthebest"; |
| 248 | \\pub const optional_string: ?[]const u8 = null; | 250 | \\pub const optional_string: ?[]const u8 = null; |
| | 251 | \\pub const version: @import("std").builtin.Version = .{ |
| | 252 | \\ .major = 0, |
| | 253 | \\ .minor = 1, |
| | 254 | \\ .patch = 2, |
| | 255 | \\}; |
| 249 | \\pub const semantic_version: @import("std").SemanticVersion = .{ | 256 | \\pub const semantic_version: @import("std").SemanticVersion = .{ |
| 250 | \\ .major = 0, | 257 | \\ .major = 0, |
| 251 | \\ .minor = 1, | 258 | \\ .minor = 1, |