From 9d13982a51a08249617c9e71be422a9f901c2c98 Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Sun, 10 Feb 2019 04:14:28 +0300 Subject: added some help --- kvmd/apps/__init__.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'kvmd/apps/__init__.py') diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index dd02d98b..0c5e64c9 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -8,6 +8,7 @@ from typing import Tuple from typing import List from typing import Dict from typing import Sequence +from typing import Optional from typing import Union import pygments @@ -23,11 +24,19 @@ from ..yamlconf.loader import load_yaml_file # ===== -def init(prog: str=sys.argv[0], add_help: bool=True) -> Tuple[argparse.ArgumentParser, List[str], Section]: - args_parser = argparse.ArgumentParser(prog=prog, add_help=add_help) - args_parser.add_argument("-c", "--config", dest="config_path", default="/etc/kvmd/kvmd.yaml", metavar="") - args_parser.add_argument("-o", "--set-options", dest="set_options", default=[], nargs="+") - args_parser.add_argument("-m", "--dump-config", dest="dump_config", action="store_true") +def init( + prog: str=sys.argv[0], + description: Optional[str]=None, + add_help: bool=True, +) -> Tuple[argparse.ArgumentParser, List[str], Section]: + + args_parser = argparse.ArgumentParser(prog=prog, description=description, add_help=add_help) + args_parser.add_argument("-c", "--config", dest="config_path", default="/etc/kvmd/kvmd.yaml", metavar="", + help="Set config file path") + args_parser.add_argument("-o", "--set-options", dest="set_options", default=[], nargs="+", + help="Override config options list (like sec/sub/opt=value)") + args_parser.add_argument("-m", "--dump-config", dest="dump_config", action="store_true", + help="View current configuration (include all overrides)") (options, remaining) = args_parser.parse_known_args(sys.argv) options.config_path = os.path.expanduser(options.config_path) -- cgit v1.2.3