Skip to content
This repository was archived by the owner on Feb 22, 2020. It is now read-only.

Commit 20e7db6

Browse files
author
hanhxiao
committed
feat(cli): show default value of each argument
1 parent 563a48c commit 20e7db6

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

gnes/cli/parser.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -379,28 +379,32 @@ def set_client_http_parser(parser=None):
379379
def get_main_parser():
380380
# create the top-level parser
381381
parser = set_base_parser()
382+
adf = argparse.ArgumentDefaultsHelpFormatter
382383
sp = parser.add_subparsers(dest='cli', title='GNES sub-commands',
383384
description='use "gnes [sub-command] --help" '
384385
'to get detailed information about each sub-command')
385386

386387
# microservices
387-
set_frontend_parser(sp.add_parser('frontend', help='start a frontend service'))
388-
set_encoder_parser(sp.add_parser('encode', help='start an encoder service'))
389-
set_indexer_parser(sp.add_parser('index', help='start an indexer service'))
390-
set_router_parser(sp.add_parser('route', help='start a router service'))
391-
set_preprocessor_parser(sp.add_parser('preprocess', help='start a preprocessor service'))
392-
set_grpc_service_parser(sp.add_parser('grpc', help='start a general purpose grpc service'))
388+
set_frontend_parser(sp.add_parser('frontend', help='start a frontend service', formatter_class=adf))
389+
set_encoder_parser(sp.add_parser('encode', help='start an encoder service', formatter_class=adf))
390+
set_indexer_parser(sp.add_parser('index', help='start an indexer service', formatter_class=adf))
391+
set_router_parser(sp.add_parser('route', help='start a router service', formatter_class=adf))
392+
set_preprocessor_parser(sp.add_parser('preprocess', help='start a preprocessor service', formatter_class=adf))
393+
set_grpc_service_parser(sp.add_parser('grpc', help='start a general purpose grpc service', formatter_class=adf))
393394

394395
pp = sp.add_parser('client', help='start a GNES client of the selected type')
395396
spp = pp.add_subparsers(dest='client', title='GNES client sub-commands',
396397
description='use "gnes client [sub-command] --help" '
397398
'to get detailed information about each client sub-command')
398399
spp.required = True
399400
# clients
400-
set_client_http_parser(spp.add_parser('http', help='start a client that allows HTTP requests as input'))
401-
set_client_cli_parser(spp.add_parser('cli', help='start a client that allows stdin as input'))
402-
set_client_benchmark_parser(spp.add_parser('benchmark', help='start a client for benchmark and unittest'))
401+
set_client_http_parser(
402+
spp.add_parser('http', help='start a client that allows HTTP requests as input', formatter_class=adf))
403+
set_client_cli_parser(spp.add_parser('cli', help='start a client that allows stdin as input', formatter_class=adf))
404+
set_client_benchmark_parser(
405+
spp.add_parser('benchmark', help='start a client for benchmark and unittest', formatter_class=adf))
403406

404407
# others
405-
set_composer_flask_parser(sp.add_parser('compose', help='start a GNES Board to visualize YAML configs'))
408+
set_composer_flask_parser(
409+
sp.add_parser('compose', help='start a GNES Board to visualize YAML configs', formatter_class=adf))
406410
return parser

0 commit comments

Comments
 (0)