From 08413ae9d7574007f9346fcffdd89c0f2c1be9bd Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 28 Jan 2021 05:58:53 +0100 Subject: [PATCH] allow passing additional arguments to the publish command --- GameBundle/GameBundle.csproj | 2 +- GameBundle/Options.cs | 2 ++ GameBundle/Program.cs | 7 +++++-- Test/Test.csproj | 3 +-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/GameBundle/GameBundle.csproj b/GameBundle/GameBundle.csproj index 3e62f55..b086a71 100644 --- a/GameBundle/GameBundle.csproj +++ b/GameBundle/GameBundle.csproj @@ -13,7 +13,7 @@ https://raw.githubusercontent.com/Ellpeck/GameBundle/master/Logo.png true gamebundle - 1.3.0 + 1.3.1 diff --git a/GameBundle/Options.cs b/GameBundle/Options.cs index 9e48780..865ca17 100644 --- a/GameBundle/Options.cs +++ b/GameBundle/Options.cs @@ -38,6 +38,8 @@ namespace GameBundle { public string LibFolder { get; set; } [Option('n', "name-builds", HelpText = "Name the build output directories by the project's name")] public bool NameBuilds { get; set; } + [Option('a', "build-args", HelpText = "Additional arguments that should be passed to the dotnet publish command")] + public string BuildArgs { get; set; } } } \ No newline at end of file diff --git a/GameBundle/Program.cs b/GameBundle/Program.cs index 8084210..792b5d0 100644 --- a/GameBundle/Program.cs +++ b/GameBundle/Program.cs @@ -11,7 +11,10 @@ namespace GameBundle { internal static class Program { private static int Main(string[] args) { - return Parser.Default.ParseArguments(args).MapResult(Run, _ => -1); + return new Parser(c => { + c.HelpWriter = Console.Error; + c.EnableDashDash = true; + }).ParseArguments(args).MapResult(Run, _ => -1); } private static int Run(Options options) { @@ -60,7 +63,7 @@ namespace GameBundle { } private static int Publish(Options options, FileInfo proj, string path, string rid, Action additionalAction = null) { - var publishResult = RunProcess(options, "dotnet", $"publish {proj.FullName} -o {path} -r {rid} -c {options.BuildConfig} /p:PublishTrimmed={options.Trim}"); + var publishResult = RunProcess(options, "dotnet", $"publish {proj.FullName} -o {path} -r {rid} -c {options.BuildConfig} /p:PublishTrimmed={options.Trim} {options.BuildArgs}"); if (publishResult != 0) return publishResult; diff --git a/Test/Test.csproj b/Test/Test.csproj index 788d4a2..6138494 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -11,8 +11,7 @@ - - +