Skip to content

Commit 178b1d3

Browse files
committed
fix: /diag behaves like a proper boolean switch
before fix, order of arguments mattered: - unless /diag is last argument, it is ignored; and the following argument is swalloed silently /diag /l gv.log -> diagnostic switch is ignored, no log file is created /l console /diag -> diagnostic output is emitted to console /l gv.log /diag -> diagnostic output is emitted to log file
1 parent 352934c commit 178b1d3

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/GitVersion.App/ArgumentParser.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,7 @@ private static bool ParseSwitches(Arguments arguments, string? name, IReadOnlyLi
212212

213213
if (name.IsSwitch("diag"))
214214
{
215-
if (value?.IsTrue() != false)
216-
{
217-
arguments.Diag = true;
218-
}
219-
215+
arguments.Diag = true;
220216
return true;
221217
}
222218

src/GitVersion.App/ArgumentParserExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public bool IsSwitch(string switchName)
7373

7474
public bool ArgumentRequiresValue(int argumentIndex)
7575
{
76-
var booleanArguments = new[] { "updateassemblyinfo", "ensureassemblyinfo", "nofetch", "nonormalize", "nocache", "allowshallow" };
76+
var booleanArguments = new[] { "updateassemblyinfo", "ensureassemblyinfo", "nofetch", "nonormalize", "nocache", "allowshallow", "diag" };
7777

7878
var argumentMightRequireValue = !booleanArguments.Contains(singleArgument[1..], StringComparer.OrdinalIgnoreCase);
7979

0 commit comments

Comments
 (0)