Add target command line option found in 'build' to 'start' in CLI to support custom targets in development.

This commit is contained in:
Gabe Cook
2020-08-07 10:09:27 -05:00
parent 3dea16798b
commit f7217b417f

View File

@@ -28,6 +28,7 @@ namespace ElectronNET.CLI.Commands
private string _clearCache = "clear-cache";
private string _paramPublishReadyToRun = "PublishReadyToRun";
private string _paramDotNetConfig = "dotnet-configuration";
private string _paramTarget = "target";
public Task<bool> ExecuteAsync()
{
@@ -59,8 +60,6 @@ namespace ElectronNET.CLI.Commands
Directory.CreateDirectory(tempPath);
}
var platformInfo = GetTargetPlatformInformation.Do(string.Empty, string.Empty);
string tempBinPath = Path.Combine(tempPath, "bin");
var resultCode = 0;
@@ -74,6 +73,21 @@ namespace ElectronNET.CLI.Commands
publishReadyToRun += "true";
}
// If target is specified as a command line argument, use it.
// Format is the same as the build command.
// If target is not specified, autodetect it.
var platformInfo = GetTargetPlatformInformation.Do(string.Empty, string.Empty);
if (parser.Arguments.ContainsKey(_paramTarget))
{
var desiredPlatform = parser.Arguments[_paramTarget][0];
string specifiedFromCustom = string.Empty;
if (desiredPlatform == "custom" && parser.Arguments[_paramTarget].Length > 1)
{
specifiedFromCustom = parser.Arguments[_paramTarget][1];
}
platformInfo = GetTargetPlatformInformation.Do(desiredPlatform, specifiedFromCustom);
}
string configuration = "Debug";
if (parser.Arguments.ContainsKey(_paramDotNetConfig))
{