Skip to content

Commit 3e2a3e3

Browse files
committed
fix help & version
1 parent 432867e commit 3e2a3e3

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/GitVersionExe.Tests/ArgumentParserTests.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,23 @@ public void NoPathAndLogfileShouldUseCurrentDirectoryTargetDirectory()
5555
}
5656

5757
[Test]
58-
public void HMeansIsHelp()
58+
public void HelpSwitchTest()
5959
{
6060
var arguments = argumentParser.ParseArguments("-h");
6161
Assert.IsNull(arguments.TargetPath);
6262
Assert.IsNull(arguments.LogFilePath);
6363
arguments.IsHelp.ShouldBe(true);
6464
}
6565

66+
[Test]
67+
public void VersionSwitchTest()
68+
{
69+
var arguments = argumentParser.ParseArguments("-version");
70+
Assert.IsNull(arguments.TargetPath);
71+
Assert.IsNull(arguments.LogFilePath);
72+
arguments.IsVersion.ShouldBe(true);
73+
}
74+
6675
[Test]
6776
public void Exec()
6877
{

src/GitVersionExe/ArgumentParser.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public Arguments ParseArguments(string[] commandLineArguments)
6363
{
6464
return new Arguments
6565
{
66-
TargetPath = System.Environment.CurrentDirectory,
6766
IsHelp = true,
6867
};
6968
}
@@ -72,7 +71,6 @@ public Arguments ParseArguments(string[] commandLineArguments)
7271
{
7372
return new Arguments
7473
{
75-
TargetPath = System.Environment.CurrentDirectory,
7674
IsVersion = true,
7775
};
7876
}

src/GitVersionExe/Arguments.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class Arguments
5252

5353
public GitVersionOptions ToOptions()
5454
{
55-
var workingDirectory = TargetPath.TrimEnd('/', '\\');
55+
var workingDirectory = TargetPath?.TrimEnd('/', '\\');
5656

5757
return new GitVersionOptions
5858
{

0 commit comments

Comments
 (0)