mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-21 20:33:00 +00:00
crude main help
This commit is contained in:
parent
b3456f8ec3
commit
a2c32b3314
3 changed files with 38 additions and 2 deletions
25
src/etc/command_help.txt
Normal file
25
src/etc/command_help.txt
Normal file
|
@ -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
|
|
@ -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'
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue