Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Sep 3, 2024
1 parent 899b866 commit 6fb353e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion source/Nuke.Tooling.Tests/ToolOptionsArgumentsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public void TestList()
Assert<ListToolOptions>(new { SimpleList = new[] { "a", "b" } }, ["--param", "a", "--param", "b"]);
Assert<ListToolOptions>(new { SeparatorList = new[] { "a", "b" } }, ["--param", "a+b"]);
Assert<ListToolOptions>(new { WhitespaceList = new[] { "a", "b" } }, ["--param", "a", "b"]);
Assert<ListToolOptions>(new { QuotedList = new[] { "a", "b" } }, ["--param:\"a b\""]);

Check failure on line 140 in source/Nuke.Tooling.Tests/ToolOptionsArgumentsTest.cs

View workflow job for this annotation

GitHub Actions / ubuntu-latest

Nuke.Common.Tests.ToolOptionsArgumentsTest.TestList

Expected options.GetArguments() to be equal to {"--param:"a b""}, but {"--param:a", "--param:b"} contains 1 item(s) too many.

Check failure on line 140 in source/Nuke.Tooling.Tests/ToolOptionsArgumentsTest.cs

View workflow job for this annotation

GitHub Actions / macos-latest

Nuke.Common.Tests.ToolOptionsArgumentsTest.TestList

Expected options.GetArguments() to be equal to {"--param:"a b""}, but {"--param:a", "--param:b"} contains 1 item(s) too many.
Assert<ListToolOptions>(new { FormattedList = new[] { "true", "false" } }, ["--param=TRUE", "--param=FALSE"]);
}

Expand All @@ -145,7 +146,8 @@ private class ListToolOptions : ToolOptions
{
[Argument(Format = "--param {value}")] public IReadOnlyList<string> SimpleList => Get<List<string>>(() => SimpleList);
[Argument(Format = "--param {value}", Separator = "+")] public IReadOnlyList<string> SeparatorList => Get<List<string>>(() => SeparatorList);
[Argument(Format = "--param {value}", Separator = " ")] public IReadOnlyList<string> WhitespaceList => Get<List<string>>(() => SeparatorList);
[Argument(Format = "--param {value}", Separator = " ")] public IReadOnlyList<string> WhitespaceList => Get<List<string>>(() => WhitespaceList);
[Argument(Format = "--param:{value}", Separator = " ", QuoteMultiple = true)] public IReadOnlyList<string> QuotedList => Get<List<string>>(() => QuotedList);
[Argument(Format = "--param={value}", FormatterMethod = nameof(Format))] public IReadOnlyList<bool> FormattedList => Get<List<bool>>(() => FormattedList);

private string Format(bool value, PropertyInfo property) => value.ToString().ToUpperInvariant();

Check warning on line 153 in source/Nuke.Tooling.Tests/ToolOptionsArgumentsTest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Use preferred body style (convert into method or operator with preferred body style)

Code body does not conform to code style settings: use statement body
Expand Down
1 change: 1 addition & 0 deletions source/Nuke.Tooling/New/ToolOptions.Arguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class ArgumentAttribute : Attribute
public string FormatterMethod { get; set; }

public string Separator { get; set; }
public bool QuoteMultiple { get; set; }
}

public class BuilderAttribute : Attribute
Expand Down
4 changes: 2 additions & 2 deletions source/Nuke.Tooling/NuGetToolPathResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ static string GetPackageExecutable(IEnumerable<string> executables)
if (frameworks.Count == 1)
return GetPackageExecutable(frameworks.Single());

framework ??= Assembly.GetEntryAssembly().NotNull().GetCustomAttribute<TargetFrameworkAttribute>()
.FrameworkDisplayName.Replace(".NET ", "net");
framework ??= (Assembly.GetEntryAssembly()?.GetCustomAttribute<TargetFrameworkAttribute>()
?.FrameworkDisplayName?.Replace(".NET ", "net")).NotNull();
var sortedFrameworks = frameworks.Select(x => x.Key)
.OrderBy(x => x == framework)
.ThenBy(x => x.Contains("."))
Expand Down

0 comments on commit 6fb353e

Please sign in to comment.