diff --git a/source/Nuke.Common.Tests/ParameterServiceTest.cs b/source/Nuke.Common.Tests/ParameterServiceTest.cs index 1561ab8a3..de987a32e 100644 --- a/source/Nuke.Common.Tests/ParameterServiceTest.cs +++ b/source/Nuke.Common.Tests/ParameterServiceTest.cs @@ -52,6 +52,7 @@ public void TestConversion(string argument, Type destinationType, object expecte [Theory] [InlineData("MSBuildConfiguration", typeof(string), "msbcfg")] [InlineData("dockerConfiguration", typeof(string), "dkrcfg")] + [InlineData("publish-dir", typeof(string), "dir")] public void TestSplitted(string argument, Type destinationType, object expectedValue) { GetService( @@ -60,7 +61,9 @@ public void TestSplitted(string argument, Type destinationType, object expectedV "-msbuild-configuration", "msbcfg", "-docker-configuration", - "dkrcfg" + "dkrcfg", + "--publish-dir", + "dir" }).GetCommandLineArgument(argument, destinationType).Should().Be(expectedValue); } diff --git a/source/Nuke.Common/Execution/ParameterService.cs b/source/Nuke.Common/Execution/ParameterService.cs index 22bd8f054..63ed3742c 100644 --- a/source/Nuke.Common/Execution/ParameterService.cs +++ b/source/Nuke.Common/Execution/ParameterService.cs @@ -160,7 +160,7 @@ public object GetPositionalCommandLineArguments(Type destinationType, char? sepa return GetDefaultValue(destinationType); return ConvertCommandLineArguments( - $"$all-positional", + "$all-positional", positionalArguments, destinationType, _commandLineArguments, @@ -204,7 +204,7 @@ private bool HasCommandLineArgument(string argumentName, bool checkNames) private int GetCommandLineArgumentIndex(string argumentName, bool checkNames) { var index = Array.FindLastIndex(_commandLineArguments, - x => x.StartsWith("-") && x.Replace("-", string.Empty).EqualsOrdinalIgnoreCase(argumentName)); + x => x.StartsWith("-") && x.Replace("-", string.Empty).EqualsOrdinalIgnoreCase(argumentName.Replace("-", string.Empty))); if (index == -1 && checkNames) {