@@ -158,10 +158,24 @@ pub fn parser(pre_flight_settings: PreFlightSettings) -> Command {
158
158
. infer_subcommands ( pre_flight_settings. infer_subcommands )
159
159
. infer_long_args ( pre_flight_settings. infer_long_options )
160
160
. subcommands ( nodes_subcommands ( pre_flight_settings. clone ( ) ) ) ;
161
+ let parameters_group = Command :: new ( "parameters" )
162
+ . about ( "Operations on runtime parameters" )
163
+ . infer_subcommands ( pre_flight_settings. infer_subcommands )
164
+ . infer_long_args ( pre_flight_settings. infer_long_options )
165
+ . after_help ( color_print:: cformat!(
166
+ "<bold>Doc guide</bold>: {}" ,
167
+ RUNTIME_PARAMETER_GUIDE_URL
168
+ ) )
169
+ . subcommand_value_name ( "runtime_parameter" )
170
+ . subcommands ( parameters_subcommands ( pre_flight_settings. clone ( ) ) ) ;
161
171
let policies_group = Command :: new ( "policies" )
162
172
. about ( "Operations on policies" )
163
173
. infer_subcommands ( pre_flight_settings. infer_subcommands )
164
174
. infer_long_args ( pre_flight_settings. infer_long_options )
175
+ . after_help ( color_print:: cformat!(
176
+ "<bold>Doc guide</bold>: {}" ,
177
+ POLICY_GUIDE_URL
178
+ ) )
165
179
. subcommand_value_name ( "policy" )
166
180
. subcommands ( policies_subcommands ( pre_flight_settings. clone ( ) ) ) ;
167
181
let publish_group = Command :: new ( "publish" )
@@ -246,6 +260,7 @@ pub fn parser(pre_flight_settings: PreFlightSettings) -> Command {
246
260
import_group,
247
261
list_group,
248
262
nodes_group,
263
+ parameters_group,
249
264
policies_group,
250
265
publish_group,
251
266
purge_group,
@@ -1201,6 +1216,66 @@ fn purge_subcommands(pre_flight_settings: PreFlightSettings) -> [Command; 1] {
1201
1216
[ queue_cmd] . map ( |cmd| cmd. infer_long_args ( pre_flight_settings. infer_long_options ) )
1202
1217
}
1203
1218
1219
+ fn parameters_subcommands ( pre_flight_settings : PreFlightSettings ) -> [ Command ; 3 ] {
1220
+ let list_cmd = Command :: new ( "list" )
1221
+ . arg (
1222
+ Arg :: new ( "component" )
1223
+ . long ( "component" )
1224
+ . help ( "component (for example: federation-upstream, vhost-limits)" )
1225
+ . required ( false ) ,
1226
+ )
1227
+ . long_about ( "Lists runtime parameters" )
1228
+ . after_help ( color_print:: cformat!(
1229
+ "<bold>Doc guide</bold>: {}" ,
1230
+ RUNTIME_PARAMETER_GUIDE_URL
1231
+ ) ) ;
1232
+
1233
+ let set_cmd = Command :: new ( "set" )
1234
+ . alias ( "declare" )
1235
+ . about ( "Sets a runtime parameter" )
1236
+ . after_help ( color_print:: cformat!(
1237
+ "<bold>Doc guide:</bold>: {}" ,
1238
+ RUNTIME_PARAMETER_GUIDE_URL
1239
+ ) )
1240
+ . arg (
1241
+ Arg :: new ( "name" )
1242
+ . long ( "name" )
1243
+ . help ( "parameter's name" )
1244
+ . required ( true ) ,
1245
+ )
1246
+ . arg (
1247
+ Arg :: new ( "component" )
1248
+ . long ( "component" )
1249
+ . help ( "component (eg. federation)" )
1250
+ . required ( true ) ,
1251
+ )
1252
+ . arg (
1253
+ Arg :: new ( "value" )
1254
+ . long ( "value" )
1255
+ . help ( "parameter's value" )
1256
+ . required ( true ) ,
1257
+ ) ;
1258
+
1259
+ let clear_cmd = Command :: new ( "clear" )
1260
+ . alias ( "delete" )
1261
+ . about ( "Clears (deletes) a runtime parameter" )
1262
+ . arg (
1263
+ Arg :: new ( "name" )
1264
+ . long ( "name" )
1265
+ . help ( "parameter's name" )
1266
+ . required ( true ) ,
1267
+ )
1268
+ . arg (
1269
+ Arg :: new ( "component" )
1270
+ . long ( "component" )
1271
+ . help ( "component (eg. federation-upstream)" )
1272
+ . required ( true ) ,
1273
+ ) ;
1274
+
1275
+ [ clear_cmd, list_cmd, set_cmd]
1276
+ . map ( |cmd| cmd. infer_long_args ( pre_flight_settings. infer_long_options ) )
1277
+ }
1278
+
1204
1279
fn policies_subcommands ( pre_flight_settings : PreFlightSettings ) -> [ Command ; 5 ] {
1205
1280
let declare_cmd = Command :: new ( "declare" )
1206
1281
. about ( "Creates or updates a policy" )
@@ -1280,8 +1355,8 @@ fn policies_subcommands(pre_flight_settings: PreFlightSettings) -> [Command; 5]
1280
1355
1281
1356
[
1282
1357
declare_cmd,
1283
- list_cmd,
1284
1358
delete_cmd,
1359
+ list_cmd,
1285
1360
list_in_cmd,
1286
1361
list_matching_cmd,
1287
1362
]
0 commit comments