Merge pull request #342 from jamiebrynes7/bugfix/check-required-args

Handle missing `/target` argument for `build` command.
This commit is contained in:
Gregor Biswanger
2019-11-27 20:18:37 +01:00
committed by GitHub
2 changed files with 11 additions and 0 deletions

View File

@@ -1,5 +1,9 @@
# Not released
ElectronNET.CLI
* Fixed a bug where `electronize build` with no arguments would throw a `KeyNotFoundException`.
# Released
# 5.30.1

View File

@@ -50,6 +50,13 @@ namespace ElectronNET.CLI.Commands
SimpleCommandLineParser parser = new SimpleCommandLineParser();
parser.Parse(_args);
if (!parser.Arguments.ContainsKey(_paramTarget))
{
Console.WriteLine($"Error: missing '{_paramTarget}' argument.");
Console.WriteLine(COMMAND_ARGUMENTS);
return false;
}
var desiredPlatform = parser.Arguments[_paramTarget][0];
string specifiedFromCustom = string.Empty;
if (desiredPlatform == "custom" && parser.Arguments[_paramTarget].Length > 1)