Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add blame option #26

Merged
merged 1 commit into from
May 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/RerunCommand/RerunCommandConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class RerunCommandConfiguration
public bool NoBuild { get; private set; }
public bool NoRestore { get; private set; }
public int Delay { get; private set; }
public bool Blame { get; private set; }

#endregion Properties

Expand Down Expand Up @@ -94,6 +95,14 @@ public class RerunCommandConfiguration
IsRequired = false,
};

private readonly Option<string> BlameOption =
new(new[] { "--blame" })
{
Description = "Runs the tests in blame mode.",
IsRequired = false,
Arity = ArgumentArity.Zero
};

#endregion Options

public void Set(Command cmd)
Expand All @@ -108,6 +117,7 @@ public void Set(Command cmd)
cmd.Add(NoBuildOption);
cmd.Add(NoRestoreOption);
cmd.Add(DelayOption);
cmd.Add(BlameOption);
}

public void GetValues(InvocationContext context)
Expand All @@ -122,6 +132,7 @@ public void GetValues(InvocationContext context)
NoBuild = context.ParseResult.FindResultFor(NoBuildOption) is not null;
NoRestore = context.ParseResult.FindResultFor(NoRestoreOption) is not null;
Delay = context.ParseResult.GetValueForOption(DelayOption) * 1000;
Blame = context.ParseResult.FindResultFor(BlameOption) is not null;
}

public string GetArgumentList()
Expand All @@ -131,7 +142,8 @@ public string GetArgumentList()
AddArguments(Settings, SettingsOption),
AddArguments(TrxLogger, LoggerOption),
AddArguments(NoBuild, NoBuildOption),
AddArguments(NoRestore, NoRestoreOption));
AddArguments(NoRestore, NoRestoreOption),
AddArguments(Blame, BlameOption));

public string AddArguments<T>(T value, Option<T> option)
=> value is not null
Expand Down