diff --git a/src/etc/command_help.txt b/src/etc/command_help.txt new file mode 100644 index 0000000..781e9ff --- /dev/null +++ b/src/etc/command_help.txt @@ -0,0 +1,25 @@ +COMMANDS +======== + +net-up +up +down +net-down +update +enable +disable + +show +list +logs +sh + +build +pull +push + +init +conf-copy +conf-purge + +cmd diff --git a/src/kiwi/_constants.py b/src/kiwi/_constants.py index 715372e..e4bb229 100644 --- a/src/kiwi/_constants.py +++ b/src/kiwi/_constants.py @@ -19,6 +19,7 @@ HEADER_KIWI_CONF_NAME = f"{KIWI_ROOT}/etc/kiwi_header.yml" DEFAULT_KIWI_CONF_NAME = f"{KIWI_ROOT}/etc/kiwi_default.yml" VERSION_TAG_NAME = f"{KIWI_ROOT}/etc/version_tag" DEFAULT_DOCKER_COMPOSE_NAME = f"{KIWI_ROOT}/etc/docker-compose_default.yml" +COMMAND_HELP_TEXT_NAME = f"{KIWI_ROOT}/etc/command_help.txt" # special config directory in projects CONF_DIRECTORY_NAME = 'conf' diff --git a/src/kiwi/parser.py b/src/kiwi/parser.py index 2814c4c..01c869f 100644 --- a/src/kiwi/parser.py +++ b/src/kiwi/parser.py @@ -1,6 +1,9 @@ # system import argparse +# local +from ._constants import COMMAND_HELP_TEXT_NAME + class Parser: """Singleton: Main CLI arguments parser""" @@ -14,10 +17,17 @@ class Parser: __args = None def __init__(self): - # create main parsers + # add version data from separate file (keeps default config cleaner) + with open(COMMAND_HELP_TEXT_NAME, 'r') as stream: + command_help_text = stream.read().strip() + + # create main parser self.__parser = argparse.ArgumentParser( - description='kiwi-config' + description='kiwi-config', + usage='%(prog)s [command]', + epilog=command_help_text, ) + self.__parser.formatter_class = argparse.RawDescriptionHelpFormatter # main arguments self.__parser.add_argument(