From e12d4a3b00e7ba477b5665412904e0213f4bbb52 Mon Sep 17 00:00:00 2001 From: Alek Date: Thu, 9 Sep 2021 16:01:12 +0800 Subject: [PATCH] Updated to use McMaster.Extensions.CommandLineUtils 3.0.0 --- src/Dotnet.Script/Dotnet.Script.csproj | 2 +- src/Dotnet.Script/Program.cs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj index 363a7b33..9b13966a 100644 --- a/src/Dotnet.Script/Dotnet.Script.csproj +++ b/src/Dotnet.Script/Dotnet.Script.csproj @@ -25,7 +25,7 @@ - + diff --git a/src/Dotnet.Script/Program.cs b/src/Dotnet.Script/Program.cs index c599b6b9..ff77a012 100644 --- a/src/Dotnet.Script/Program.cs +++ b/src/Dotnet.Script/Program.cs @@ -55,8 +55,9 @@ public static Func CreateLogFactory private static int Wain(string[] args) { - var app = new CommandLineApplication(throwOnUnexpectedArg: false) + var app = new CommandLineApplication() { + UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.CollectAndContinue, ExtendedHelpText = "Starting without a path to a CSX file or a command, starts the REPL (interactive) mode." }; @@ -83,7 +84,7 @@ private static int Wain(string[] args) var code = c.Argument("code", "Code to execute."); var cwd = c.Option("-cwd |--workingdirectory ", "Working directory for the code compiler. Defaults to current directory.", CommandOptionType.SingleValue); c.HelpOption(helpOptionTemplate); - c.OnExecute(async () => + c.OnExecuteAsync(async (cancellationToken) => { var source = code.Value; if (string.IsNullOrWhiteSpace(source)) @@ -198,7 +199,7 @@ private static int Wain(string[] args) var dllPath = c.Argument("dll", "Path to DLL based script"); var commandDebugMode = c.Option(DebugFlagShort + " | " + DebugFlagLong, "Enables debug output.", CommandOptionType.NoValue); c.HelpOption(helpOptionTemplate); - c.OnExecute(async () => + c.OnExecuteAsync(async (cancellationToken) => { if (string.IsNullOrWhiteSpace(dllPath.Value)) { @@ -217,7 +218,7 @@ private static int Wain(string[] args) }); }); - app.OnExecute(async () => + app.OnExecuteAsync(async (cancellationToken) => { int exitCode = 0;