Skip to content

Commit d2b3c28

Browse files
Merge pull request #342 from jamiebrynes7/bugfix/check-required-args
Handle missing `/target` argument for `build` command.
2 parents 94c4cd8 + 4014ef7 commit d2b3c28

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Not released
22

3+
ElectronNET.CLI
4+
5+
* Fixed a bug where `electronize build` with no arguments would throw a `KeyNotFoundException`.
6+
37
# Released
48

59
# 5.30.1

ElectronNET.CLI/Commands/BuildCommand.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ public Task<bool> ExecuteAsync()
5050
SimpleCommandLineParser parser = new SimpleCommandLineParser();
5151
parser.Parse(_args);
5252

53+
if (!parser.Arguments.ContainsKey(_paramTarget))
54+
{
55+
Console.WriteLine($"Error: missing '{_paramTarget}' argument.");
56+
Console.WriteLine(COMMAND_ARGUMENTS);
57+
return false;
58+
}
59+
5360
var desiredPlatform = parser.Arguments[_paramTarget][0];
5461
string specifiedFromCustom = string.Empty;
5562
if (desiredPlatform == "custom" && parser.Arguments[_paramTarget].Length > 1)

0 commit comments

Comments
 (0)