Skip to content

Commit

Permalink
cli: Added TargetFramework option.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Jun 30, 2024
1 parent 7e0a3c2 commit c6a0306
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libs/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</ItemGroup>

<PropertyGroup Label="Versioning">
<Version>0.11.7</Version>
<Version>0.11.8</Version>
<MinVerMinimumMajorMinor>0.1</MinVerMinimumMajorMinor>
<MinVerTagPrefix>v</MinVerTagPrefix>
<MinVerDefaultPreReleaseIdentifiers>dev</MinVerDefaultPreReleaseIdentifiers>
Expand Down
9 changes: 8 additions & 1 deletion src/libs/OpenApiGenerator.Cli/Commands/GenerateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public class GenerateCommand : Command
aliases: ["--output", "-o"],
getDefaultValue: () => string.Empty,
description: "Output file path");
var targetFrameworkOption = new Option<string>(
aliases: ["--targetFramework", "-t"],
getDefaultValue: () => "netstandard2.0",
description: "TargetFramework for the generated code");
var namespaceOption = new Option<string>(
aliases: ["--namespace", "-n"],
getDefaultValue: () => string.Empty,
Expand All @@ -32,6 +36,7 @@ public class GenerateCommand : Command
description: "Generate all models in a single file");
AddArgument(inputOption);
AddOption(outputOption);
AddOption(targetFrameworkOption);
AddOption(namespaceOption);
AddOption(clientClassNameOption);
AddOption(singleFileOption);
Expand All @@ -40,6 +45,7 @@ public class GenerateCommand : Command
HandleAsync,
inputOption,
outputOption,
targetFrameworkOption,
namespaceOption,
clientClassNameOption,
singleFileOption);
Expand All @@ -48,6 +54,7 @@ public class GenerateCommand : Command
private static async Task HandleAsync(
string inputPath,
string outputPath,
string targetFramework,
string @namespace,
string clientClassName,
bool generateAsSingleFile)
Expand All @@ -69,7 +76,7 @@ private static async Task HandleAsync(
}

var settings = new Settings(
TargetFramework: "netstandard2.0",
TargetFramework: targetFramework,
Namespace: @namespace,
ClassName: clientClassName,
NamingConvention: default,
Expand Down

0 comments on commit c6a0306

Please sign in to comment.