@@ -28,7 +28,7 @@ public static class Helpers
28
28
HttpMethod . Delete . Method ,
29
29
HttpMethod . Options . Method
30
30
} ;
31
-
31
+
32
32
public static readonly JsonSerializerOptions JsonSerializerOptions = new ( )
33
33
{
34
34
WriteIndented = true ,
@@ -81,7 +81,7 @@ private static Parser ConstructCommand(this IServiceProvider serviceProvider, Fu
81
81
{
82
82
var context = serviceProvider . GetRequiredService < HttpContext > ( ) ;
83
83
context . InvocationContext = invocationContext ;
84
-
84
+
85
85
var requestModel = context . Request ;
86
86
requestModel . ParseResult = invocationContext . ParseResult ;
87
87
@@ -105,7 +105,7 @@ private static Parser ConstructCommand(this IServiceProvider serviceProvider, Fu
105
105
. WhereNotNull ( )
106
106
. Where ( x => ! x . StartsWith ( '-' ) )
107
107
. ToArray ( ) ;
108
-
108
+
109
109
await next ( invocationContext ) ;
110
110
} )
111
111
;
@@ -118,7 +118,7 @@ private static Command InitializeCommandInternal(IServiceProvider serviceProvide
118
118
{
119
119
Name = "http" ,
120
120
} ;
121
-
121
+
122
122
// var methodArgument = new Argument<HttpMethod>("method")
123
123
// {
124
124
// Description = "Request method",
@@ -128,14 +128,14 @@ private static Command InitializeCommandInternal(IServiceProvider serviceProvide
128
128
// var allowedMethods = HttpMethods.ToArray();
129
129
// methodArgument.AddCompletions(allowedMethods);
130
130
// command.AddArgument(methodArgument);
131
-
131
+
132
132
// var urlArgument = new Argument<string>("url")
133
133
// {
134
134
// Description = "Request url",
135
135
// Arity = ArgumentArity.ExactlyOne
136
136
// };
137
137
// command.AddArgument(urlArgument);
138
-
138
+
139
139
// options
140
140
foreach ( var option in
141
141
serviceProvider
@@ -151,7 +151,7 @@ private static Command InitializeCommandInternal(IServiceProvider serviceProvide
151
151
command . AddOption ( option ) ;
152
152
}
153
153
command . TreatUnmatchedTokensAsErrors = false ;
154
-
154
+
155
155
handler ??= async invocationContext =>
156
156
{
157
157
var context = serviceProvider . ResolveRequiredService < HttpContext > ( ) ;
@@ -164,7 +164,7 @@ await serviceProvider.ResolveRequiredService<IRequestExecutor>()
164
164
command . SetHandler ( handler ) ;
165
165
return command ;
166
166
}
167
-
167
+
168
168
public static IServiceCollection RegisterApplicationServices ( this IServiceCollection serviceCollection )
169
169
{
170
170
serviceCollection
@@ -230,13 +230,13 @@ public static IServiceCollection RegisterApplicationServices(this IServiceCollec
230
230
. AddResponseMiddleware < JsonSchemaValidationMiddleware > ( )
231
231
;
232
232
}
233
-
233
+
234
234
public static async Task < int > Handle ( this IServiceProvider services , string [ ] args )
235
235
{
236
236
var commandParser = services . ConstructCommand ( ) ;
237
237
return await commandParser . InvokeAsync ( args ) ;
238
238
}
239
-
239
+
240
240
public static async Task < int > Handle ( this IServiceProvider services , string commandLine , Func < InvocationContext , Task > ? handler = null )
241
241
{
242
242
var commandParser = services . ConstructCommand ( handler ) ;
0 commit comments