From 88909355f946c0afc92ba28f62e31dc1c0f2bd2f Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Fri, 21 Jan 2022 07:26:41 +0300 Subject: show default values for --help --- kvmd/apps/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'kvmd/apps/__init__.py') diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index 4b7a6588..d40e2feb 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -120,11 +120,16 @@ def init( argv = (argv or sys.argv) assert len(argv) > 0 - args_parser = argparse.ArgumentParser(prog=(prog or argv[0]), description=description, add_help=add_help) - args_parser.add_argument("-c", "--config", dest="config_path", default="/etc/kvmd/main.yaml", metavar="", - type=valid_abs_file, help="Set config file path") + args_parser = argparse.ArgumentParser( + prog=(prog or argv[0]), + description=description, + add_help=add_help, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + args_parser.add_argument("-c", "--config", dest="config_path", default="/etc/kvmd/main.yaml", type=valid_abs_file, + help="Set config file path", metavar="") args_parser.add_argument("-o", "--set-options", dest="set_options", default=[], nargs="+", - help="Override config options list (like sec/sub/opt=value)") + help="Override config options list (like sec/sub/opt=value)", metavar="",) args_parser.add_argument("-m", "--dump-config", dest="dump_config", action="store_true", help="View current configuration (include all overrides)") if check_run: -- cgit v1.2.3