Skip to content

Commit 2e634a8

Browse files
committed
VersionBump : v3.0.3-preview.4
1 parent 13f7eb7 commit 2e634a8

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

src/CodeOfChaos.CliArgsParser.Generators/CodeOfChaos.CliArgsParser.Generators.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<IsPackable>true</IsPackable>
1414
<PackageId>CodeOfChaos.CliArgsParser.Generators</PackageId>
15-
<Version>3.0.3-preview.3</Version> <!-- Package version -->
15+
<Version>3.0.3-preview.4</Version> <!-- Package version -->
1616
<Authors>Anna Sas</Authors>
1717
<Description>CliArgsParser is a library built around Dependency Injection to allow you to create CLI tools with ease</Description>
1818
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-cli_args_parser/</PackageProjectUrl>

src/CodeOfChaos.CliArgsParser.Library/CodeOfChaos.CliArgsParser.Library.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<IsPackable>true</IsPackable>
1010
<PackageId>CodeOfChaos.CliArgsParser.Library</PackageId> <!-- Main package name -->
11-
<Version>3.0.3-preview.3</Version> <!-- Package version -->
11+
<Version>3.0.3-preview.4</Version> <!-- Package version -->
1212
<Authors>Anna Sas</Authors>
1313
<Description>CliArgsParser is a library built around Dependency Injection to allow you to create CLI tools with ease</Description>
1414
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-cli_args_parser/</PackageProjectUrl>

src/CodeOfChaos.CliArgsParser/CodeOfChaos.CliArgsParser.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<IsPackable>true</IsPackable>
99
<PackageId>CodeOfChaos.CliArgsParser</PackageId> <!-- Main package name -->
10-
<Version>3.0.3-preview.3</Version> <!-- Package version -->
10+
<Version>3.0.3-preview.4</Version> <!-- Package version -->
1111
<Authors>Anna Sas</Authors>
1212
<Description>CliArgsParser is a library built around Dependency Injection to allow you to create CLI tools with ease</Description>
1313
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-cli_args_parser/</PackageProjectUrl>

src/CodeOfChaos.CliArgsParser/UserInputRegistry.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,17 @@ public T GetParameterByPossibleNames<T>(string name, string shortName) {
8383
}
8484

8585
public T? GetOptionalParameterByPossibleNames<T>(string name, string shortName) {
86-
if (_parameters.TryGetValue(name, out object? parameter)) return (T)Convert.ChangeType(parameter, typeof(T));
87-
if (_parameters.TryGetValue(shortName, out parameter)) return (T)Convert.ChangeType(parameter, typeof(T));
86+
if (!_parameters.TryGetValue(name, out object? parameter) && !_parameters.TryGetValue(shortName, out parameter)) return default;
87+
if (parameter is T tValue) return tValue;
8888

89-
return default;
89+
// Handle nullable value types
90+
Type targetType = Nullable.GetUnderlyingType(typeof(T)) ?? typeof(T);
91+
92+
try {
93+
return (T)Convert.ChangeType(parameter, targetType);
94+
} catch {
95+
return default; // Return default if conversion fails
96+
}
9097
}
9198

9299
public T GetParameter<T>(string key) {

src/Tools.CodeOfChaos.CliArgsParser/Properties/launchSettings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
"profiles": {
33
"Major Version Bump": {
44
"commandName": "Project",
5-
"commandLineArgs": "version-bump --section=\"major\" --projects=\"CodeOfChaos.CliArgsParser;CodeOfChaos.CliArgsParser.Library;CodeOfChaos.CliArgsParser.Generators;\""
5+
"commandLineArgs": "version-bump --section=\"major\" --projects=\"CodeOfChaos.CliArgsParser;CodeOfChaos.CliArgsParser.Library;CodeOfChaos.CliArgsParser.Generators;\" --push"
66
},
77
"Minor Version Bump": {
88
"commandName": "Project",
9-
"commandLineArgs": "version-bump --section=\"minor\" --projects=\"CodeOfChaos.CliArgsParser;CodeOfChaos.CliArgsParser.Library;CodeOfChaos.CliArgsParser.Generators;\""
9+
"commandLineArgs": "version-bump --section=\"minor\" --projects=\"CodeOfChaos.CliArgsParser;CodeOfChaos.CliArgsParser.Library;CodeOfChaos.CliArgsParser.Generators;\" --push"
1010
},
1111
"Patch Version Bump": {
1212
"commandName": "Project",
13-
"commandLineArgs": "version-bump --section=\"patch\" --projects=\"CodeOfChaos.CliArgsParser;CodeOfChaos.CliArgsParser.Library;CodeOfChaos.CliArgsParser.Generators;\""
13+
"commandLineArgs": "version-bump --section=\"patch\" --projects=\"CodeOfChaos.CliArgsParser;CodeOfChaos.CliArgsParser.Library;CodeOfChaos.CliArgsParser.Generators;\" --push"
1414
},
1515
"Preview Version Bump" : {
1616
"commandName": "Project",
17-
"commandLineArgs": "version-bump --section=\"preview\" --projects=\"CodeOfChaos.CliArgsParser;CodeOfChaos.CliArgsParser.Library;CodeOfChaos.CliArgsParser.Generators;\""
17+
"commandLineArgs": "version-bump --section=\"preview\" --projects=\"CodeOfChaos.CliArgsParser;CodeOfChaos.CliArgsParser.Library;CodeOfChaos.CliArgsParser.Generators;\" --push"
1818
}
1919
}
2020
}

0 commit comments

Comments
 (0)