@@ -19,9 +19,6 @@ static Task<int> Main(string[] args)
19
19
var output = new Option < string > ( name : "--output" , description : "The output file path." ,
20
20
getDefaultValue : ( ) => "swagger.json" ) ;
21
21
22
- var useTagForOutput = new Option < bool > ( name : "--use-tag-for-output" , description : "If set to true the output file will be named with the readmeTag used for the run" ,
23
- getDefaultValue : ( ) => false ) ;
24
-
25
22
var readmeFile = new Option < string > ( name : "--readme" , "The input readme file." ) ;
26
23
27
24
var readmeTag = new Option < string > ( name : "--tag" , description : "Readme tag used to generate swagger apiView" ,
@@ -40,7 +37,6 @@ static Task<int> Main(string[] args)
40
37
{
41
38
swaggers ,
42
39
output ,
43
- useTagForOutput ,
44
40
packageName ,
45
41
swaggerLinks ,
46
42
readmeFile ,
@@ -50,7 +46,7 @@ static Task<int> Main(string[] args)
50
46
51
47
cmd . Description = "Parse swagger file into codefile." ;
52
48
53
- cmd . SetHandler ( async ( IEnumerable < string > swaggerFiles , string outputFile , bool useTagForOutputFileName , string package , IEnumerable < string > links , string readme , string tag ) =>
49
+ cmd . SetHandler ( async ( IEnumerable < string > swaggerFiles , string outputFile , string package , IEnumerable < string > links , string readme , string tag ) =>
54
50
{
55
51
var swaggerLinksArray = links . ToList ( ) ;
56
52
@@ -60,20 +56,20 @@ static Task<int> Main(string[] args)
60
56
{
61
57
readme = Path . GetFullPath ( readme ) ;
62
58
}
63
- await HandleGenerateCodeFile ( enumerable , outputFile , useTagForOutputFileName , package , swaggerLinksArray , readme , tag ) ;
64
- } , swaggers , output , useTagForOutput , packageName , swaggerLinks , readmeFile , readmeTag ) ;
59
+ await HandleGenerateCodeFile ( enumerable , outputFile , package , swaggerLinksArray , readme , tag ) ;
60
+ } , swaggers , output , packageName , swaggerLinks , readmeFile , readmeTag ) ;
65
61
66
62
return Task . FromResult ( cmd . Invoke ( args ) ) ;
67
63
}
68
64
69
- static async Task HandleGenerateCodeFile ( IEnumerable < string > swaggers , string output , bool useTagForOutput , string packageName , List < string > swaggerLinks , string readmeFile , string readmeTag )
65
+ static async Task HandleGenerateCodeFile ( IEnumerable < string > swaggers , string output , string packageName , List < string > swaggerLinks , string readmeFile , string readmeTag )
70
66
{
71
67
72
68
var swaggerFilePaths = swaggers . ToList ( ) ;
73
69
if ( readmeFile != null )
74
70
{
75
71
var readmeFileDir = Path . GetDirectoryName ( readmeFile ) ;
76
- var swaggerFiles = ReadmeParser . GetSwaggerFilesFromReadme ( readmeFile , ref readmeTag ) ;
72
+ var swaggerFiles = ReadmeParser . GetSwaggerFilesFromReadme ( readmeFile , readmeTag ) ;
77
73
swaggerFilePaths = swaggerFilePaths . Concat ( swaggerFiles . Select ( it => Path . Join ( readmeFileDir , it ) ) ) . ToList ( ) ;
78
74
}
79
75
@@ -118,13 +114,6 @@ static async Task HandleGenerateCodeFile(IEnumerable<string> swaggers, string ou
118
114
119
115
var codeFile = root . GenerateCodeFile ( ) ;
120
116
var outputFilePath = Path . GetFullPath ( output ) ;
121
-
122
- if ( useTagForOutput )
123
- {
124
- output = $ "{ readmeTag } .json";
125
- outputFilePath = Path . Combine ( Path . GetDirectoryName ( outputFilePath ) , output ) ;
126
- }
127
-
128
117
await using FileStream writer = File . Open ( outputFilePath , FileMode . Create ) ;
129
118
Console . WriteLine ( $ "Generate codefile { output } successfully.") ;
130
119
await codeFile . SerializeAsync ( writer ) ;
0 commit comments