Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions src/Refitter/GenerateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public override ValidationResult Validate(CommandContext context, Settings setti
if (!settings.NoLogging)
Analytics.Configure();

if (context.Arguments.Any(a => a.Equals("--version", StringComparison.OrdinalIgnoreCase)) ||
context.Arguments.Any(a => a.Equals("-v", StringComparison.OrdinalIgnoreCase)))
return ValidationResult.Success();

return SettingsValidator.Validate(settings);
}

Expand All @@ -35,6 +39,12 @@ public override async Task<int> ExecuteAsync(CommandContext context, Settings se
? "[green]Support key: Unavailable when logging is disabled[/]"
: $"[green]Support key: {SupportInformation.GetSupportKey()}[/]");

if (context.Arguments.Any(a => a.Equals("--version", StringComparison.OrdinalIgnoreCase)) ||
context.Arguments.Any(a => a.Equals("-v", StringComparison.OrdinalIgnoreCase)))
{
return 0;
}

if (!string.IsNullOrWhiteSpace(settings.SettingsFilePath))
{
var json = await File.ReadAllTextAsync(settings.SettingsFilePath);
Expand Down
10 changes: 10 additions & 0 deletions test/smoke-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ function RunTests {
Start-Process "dotnet" -Args "publish ../src/Refitter/Refitter.csproj -p:PublishReadyToRun=true -o bin -f net8.0" -NoNewWindow -PassThru | Wait-Process
}

Write-Host "refitter --version"
$process = Start-Process "./bin/refitter" `
-Args " --version" `
-NoNewWindow `
-PassThru
$process | Wait-Process
if ($process.ExitCode -ne 0) {
throw "Show version failed!"
}

GenerateAndBuild -format " " -namespace " " -outputPath "SwaggerPetstoreDirect.generated.cs" -args "--settings-file ./petstore.refitter" -buildFromSource $buildFromSource
GenerateAndBuild -format " " -namespace " " -args "--settings-file ./Apizr/petstore.apizr.refitter" -csproj "./Apizr/Sample.csproj" -buildFromSource $buildFromSource
GenerateAndBuild -format " " -namespace " " -args "--settings-file ./MultipleFiles/petstore.refitter" -csproj "MultipleFiles/Client/Client.csproj" -buildFromSource $buildFromSource
Expand Down