1
- using System ;
2
- using System . CommandLine ;
1
+ using System . CommandLine ;
3
2
using System . CommandLine . Invocation ;
4
3
using System . IO ;
5
4
using System . Threading . Tasks ;
6
- using Microsoft . OpenApi ;
7
5
8
6
namespace Microsoft . OpenApi . Tool
9
7
{
10
- class Program
8
+ static class Program
11
9
{
12
- static async Task < int > OldMain ( string [ ] args )
13
- {
14
-
15
- var command = new RootCommand
16
- {
17
- new Option ( "--input" , "Input OpenAPI description file path or URL" , typeof ( string ) ) ,
18
- new Option ( "--output" , "Output OpenAPI description file" , typeof ( FileInfo ) , arity : ArgumentArity . ZeroOrOne ) ,
19
- new Option ( "--version" , "OpenAPI specification version" , typeof ( OpenApiSpecVersion ) ) ,
20
- new Option ( "--format" , "File format" , typeof ( OpenApiFormat ) ) ,
21
- new Option ( "--inline" , "Inline $ref instances" , typeof ( bool ) ) ,
22
- new Option ( "--resolveExternal" , "Resolve external $refs" , typeof ( bool ) )
23
- } ;
24
-
25
- command . Handler = CommandHandler . Create < string , FileInfo , OpenApiSpecVersion , OpenApiFormat , bool , bool > (
26
- OpenApiService . ProcessOpenApiDocument ) ;
27
-
28
- // Parse the incoming args and invoke the handler
29
- return await command . InvokeAsync ( args ) ;
30
- }
31
-
32
10
static async Task < int > Main ( string [ ] args )
33
11
{
34
12
var rootCommand = new RootCommand ( ) {
@@ -47,9 +25,10 @@ static async Task<int> Main(string[] args)
47
25
new Option ( "--version" , "OpenAPI specification version" , typeof ( OpenApiSpecVersion ) ) ,
48
26
new Option ( "--format" , "File format" , typeof ( OpenApiFormat ) ) ,
49
27
new Option ( "--inline" , "Inline $ref instances" , typeof ( bool ) ) ,
50
- new Option ( "--resolveExternal" , "Resolve external $refs" , typeof ( bool ) )
28
+ new Option ( "--resolveExternal" , "Resolve external $refs" , typeof ( bool ) ) ,
29
+ new Option ( "--filterByOperationId" , "Filters by OperationId provided" , typeof ( string ) )
51
30
} ;
52
- transformCommand . Handler = CommandHandler . Create < string , FileInfo , OpenApiSpecVersion , OpenApiFormat , bool , bool > (
31
+ transformCommand . Handler = CommandHandler . Create < string , FileInfo , OpenApiSpecVersion , OpenApiFormat , string , bool , bool > (
53
32
OpenApiService . ProcessOpenApiDocument ) ;
54
33
55
34
rootCommand . Add ( transformCommand ) ;
0 commit comments