Skip to content

Commit

Permalink
Merge pull request #548 from adamralph/cli-wrap-usage
Browse files Browse the repository at this point in the history
tweak changes to more idiomatic CliWrap usage
  • Loading branch information
adamralph authored Jun 17, 2021
2 parents 5c6853a + ad08e31 commit 99d240f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace MinVerTests.Infra
{
internal static class CommandExtensions
internal static class CliWrapExtensions
{
private static int index;

Expand All @@ -21,7 +21,7 @@ public static async Task<BufferedCommandResult> ExecuteBufferedLoggedAsync(this

var result = await command.WithValidation(CommandResultValidation.None).ExecuteBufferedAsync();

var index = Interlocked.Increment(ref CommandExtensions.index);
var index = Interlocked.Increment(ref CliWrapExtensions.index);

var log =
$@"
Expand Down Expand Up @@ -77,7 +77,7 @@ public static EnvironmentVariablesBuilder SetFrom(this EnvironmentVariablesBuild
return env;
}

public static ArgumentsBuilder AddIf(this ArgumentsBuilder args, string value, bool condition)
public static ArgumentsBuilder AddIf(this ArgumentsBuilder args, bool condition, string value)
{
if (condition)
{
Expand Down
2 changes: 1 addition & 1 deletion MinVerTests.Infra/Git.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ await Cli.Wrap("git")
.WithArguments("log --graph --pretty=format:'%d'")
.WithWorkingDirectory(path)
.ExecuteBufferedAsync()
.Select(r => r.StandardOutput);
.Select(result => result.StandardOutput);

public static Task Tag(string path, string tag) =>
Cli.Wrap("git").WithArguments($"tag {tag}").WithWorkingDirectory(path).ExecuteAsync();
Expand Down
2 changes: 1 addition & 1 deletion MinVerTests.Infra/Sdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private static void CreateGlobalJsonIfRequired(string path)
.WithArguments(args => args
.Add("build")
.Add("--no-restore")
.AddIf("--nologo", !(Version?.StartsWith("2.", StringComparison.Ordinal) ?? false))
.AddIf(!(Version?.StartsWith("2.", StringComparison.Ordinal) ?? false), "--nologo")
)
.WithEnvironmentVariables(env => env
.SetFrom(environmentVariables)
Expand Down

0 comments on commit 99d240f

Please sign in to comment.