diff options
author | Devaev Maxim <[email protected]> | 2019-02-10 04:14:28 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-02-10 04:14:28 +0300 |
commit | 9d13982a51a08249617c9e71be422a9f901c2c98 (patch) | |
tree | 42fb1ec855f8ee1131286669a194486fe4c76e32 /kvmd/apps | |
parent | d603a216a37703b5ea24ce4644d4d60b5efebcbd (diff) |
added some help
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/__init__.py | 19 | ||||
-rw-r--r-- | kvmd/apps/cleanup/__init__.py | 2 | ||||
-rw-r--r-- | kvmd/apps/kvmd/__init__.py | 2 |
3 files changed, 16 insertions, 7 deletions
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="<file>") - 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="<file>", + 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) diff --git a/kvmd/apps/cleanup/__init__.py b/kvmd/apps/cleanup/__init__.py index ad391eeb..179ec2f1 100644 --- a/kvmd/apps/cleanup/__init__.py +++ b/kvmd/apps/cleanup/__init__.py @@ -11,7 +11,7 @@ from .. import init # ===== def main() -> None: - config = init("kvmd-cleanup")[2].kvmd + config = init("kvmd-cleanup", description="Kill KVMD and clear resources")[2].kvmd logger = get_logger(0) logger.info("Cleaning up ...") diff --git a/kvmd/apps/kvmd/__init__.py b/kvmd/apps/kvmd/__init__.py index a8356b4e..2628b735 100644 --- a/kvmd/apps/kvmd/__init__.py +++ b/kvmd/apps/kvmd/__init__.py @@ -18,7 +18,7 @@ from .server import Server # ===== def main() -> None: - config = init("kvmd")[2].kvmd + config = init("kvmd", description="The main Pi-KVM daemon")[2].kvmd with gpio.bcm(): loop = asyncio.get_event_loop() |