Skip to content

Commit 6a8c6ca

Browse files
committed
adds test command
implements a new test command with an input file option. creates a run configuration for the test command in the IDE.
1 parent cb3d56e commit 6a8c6ca

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

new-cli/.run/TestCommand.run.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="TestCommand" type="DotNetProject" factoryName=".NET Project">
3+
<option name="EXE_PATH" value="$PROJECT_DIR$/GitVersion.Cli/bin/Debug/net9.0/gitversion" />
4+
<option name="PROGRAM_PARAMETERS" value="test --input-file test.txt" />
5+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
6+
<option name="PASS_PARENT_ENVS" value="1" />
7+
<option name="USE_EXTERNAL_CONSOLE" value="0" />
8+
<option name="ENV_FILE_PATHS" value="" />
9+
<option name="REDIRECT_INPUT_PATH" value="" />
10+
<option name="PTY_MODE" value="Auto" />
11+
<option name="USE_MONO" value="0" />
12+
<option name="RUNTIME_ARGUMENTS" value="" />
13+
<option name="AUTO_ATTACH_CHILDREN" value="0" />
14+
<option name="MIXED_MODE_DEBUG" value="0" />
15+
<option name="PROJECT_PATH" value="$PROJECT_DIR$/GitVersion.Cli/GitVersion.Cli.csproj" />
16+
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
17+
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
18+
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
19+
<option name="PROJECT_KIND" value="DotNetCore" />
20+
<option name="PROJECT_TFM" value="net9.0" />
21+
<method v="2">
22+
<option name="Build" />
23+
</method>
24+
</configuration>
25+
</component>

new-cli/GitVersion.Cli/TestCommand.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace GitVersion;
2+
3+
[Command("test", "Test command.")]
4+
public class TestCommand: ICommand<TestCommandSettings>
5+
{
6+
public Task<int> InvokeAsync(TestCommandSettings settings, CancellationToken cancellationToken = default)
7+
{
8+
Console.WriteLine("Input file: {0}", settings.InputFile);
9+
return Task.FromResult(0);
10+
}
11+
}
12+
13+
public record TestCommandSettings : GitVersionSettings
14+
{
15+
[Option("--input-file", "The input version file")]
16+
public required string InputFile { get; init; }
17+
}

0 commit comments

Comments
 (0)