@@ -33,7 +33,7 @@ export class BaseCommand extends Command {
33
33
}
34
34
35
35
// Appends the provided examples to description
36
- public addExamples ( examples : Array < { title : string , command : string } > ) {
36
+ public addExamples ( examples : Array < { title : string ; command : string } > ) {
37
37
this . examples . push ( ...examples ) ;
38
38
39
39
// Title of each example is a comment which describes the actual command
@@ -105,17 +105,15 @@ export class BackendCommand<OPTS extends object = object> extends BaseCommand {
105
105
. default ( 'apisix' ) ,
106
106
)
107
107
. addOption (
108
- new Option (
109
- '--server <string>' ,
110
- 'HTTP address of the backend' ,
111
- )
108
+ new Option ( '--server <string>' , 'HTTP address of the backend' )
112
109
. env ( 'ADC_SERVER' )
113
110
. default ( 'http://localhost:9180' ) ,
114
111
)
115
112
. addOption (
116
- new Option ( '--token <string>' , 'token for ADC to connect to the backend' ) . env (
117
- 'ADC_TOKEN' ,
118
- ) ,
113
+ new Option (
114
+ '--token <string>' ,
115
+ 'token for ADC to connect to the backend' ,
116
+ ) . env ( 'ADC_TOKEN' ) ,
119
117
)
120
118
. addOption (
121
119
new Option (
@@ -212,3 +210,14 @@ export class BackendCommand<OPTS extends object = object> extends BaseCommand {
212
210
}
213
211
214
212
export const NoLintOption = new Option ( '--no-lint' , 'disable lint check' ) ;
213
+ export const RequestConcurrentOption = new Option (
214
+ '--request-concurrent <integer>' ,
215
+ 'number of concurrent requests to the backend' ,
216
+ )
217
+ . default ( 10 , '10' )
218
+ . argParser ( ( val ) => {
219
+ const int = parseInt ( val ) ;
220
+ if ( ! Number . isInteger ( int ) )
221
+ throw new InvalidArgumentError ( 'Not an integer' ) ;
222
+ return int ;
223
+ } ) ;
0 commit comments