mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-21 20:33:00 +00:00
kiwi_help display
This commit is contained in:
parent
ed57e09d24
commit
80181505a2
4 changed files with 42 additions and 32 deletions
|
@ -1,5 +1,6 @@
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
|
from gettext import gettext as _
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
@ -39,3 +40,35 @@ class KiwiCLI(click.MultiCommand):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise Exception("Fail member name")
|
raise Exception("Fail member name")
|
||||||
|
|
||||||
|
def format_commands(self, ctx: click.Context, formatter: click.HelpFormatter) -> None:
|
||||||
|
commands = {
|
||||||
|
"Operation": [
|
||||||
|
"up", "down", "restart", "update",
|
||||||
|
],
|
||||||
|
"Instance Management": [
|
||||||
|
"init", "list",
|
||||||
|
],
|
||||||
|
"Project and Service Management": [
|
||||||
|
"new", "enable", "disable", "logs", "shell", "cmd",
|
||||||
|
],
|
||||||
|
"Image Handling": [
|
||||||
|
"build", "pull", "push",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
# allow for 3 times the default spacing
|
||||||
|
cmd_names = set(self.list_commands(ctx))
|
||||||
|
limit = formatter.width - 6 - max(len(cmd_name) for cmd_name in cmd_names)
|
||||||
|
|
||||||
|
for purpose, cmd_list in commands.items():
|
||||||
|
with formatter.section(_(f"Commands for {purpose}")):
|
||||||
|
formatter.write_dl([
|
||||||
|
(cmd_name, self.get_command(ctx, cmd_name).get_short_help_str(limit))
|
||||||
|
for cmd_name in cmd_list
|
||||||
|
])
|
||||||
|
|
||||||
|
cmd_names -= set(cmd_list)
|
||||||
|
|
||||||
|
if len(cmd_names) > 0:
|
||||||
|
raise Exception(f"Some commands were not registered in a group above: {cmd_names}")
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
Commands for Operation:
|
|
||||||
up Bring up the whole instance, a project or service(s) inside a project
|
|
||||||
down Bring down the whole instance, a project or service(s) inside a project
|
|
||||||
update Update the whole instance, a project or service(s) inside a project
|
|
||||||
restart Restart the whole instance, a project or service(s) inside a project
|
|
||||||
|
|
||||||
Commands for Instance Management:
|
|
||||||
init Initialize or reconfigure kiwi-scp instance
|
|
||||||
show Show projects in this instance, services inside a project or service(s) inside a project
|
|
||||||
cmd Run raw docker-compose command in a project
|
|
||||||
|
|
||||||
Commands for Project and Service Management:
|
|
||||||
new Create new empty project(s) in this instance
|
|
||||||
enable Enable project(s) in this instance
|
|
||||||
disable Disable project(s) in this instance
|
|
||||||
logs Show logs of a project or service(s) inside a project
|
|
||||||
shell Spawn shell inside a service inside a project
|
|
||||||
|
|
||||||
Commands for Image Handling:
|
|
||||||
build Build images for the whole instance, a project or service(s) inside a project
|
|
||||||
pull Pull images for the whole instance, a project or service(s) inside a project
|
|
||||||
push Push images for the whole instance, a project or service(s) inside a project
|
|
|
@ -1,9 +0,0 @@
|
||||||
kiwi is the simple tool for managing container servers.
|
|
||||||
|
|
||||||
Features:
|
|
||||||
- Group services into projects using their own docker-compose.yml
|
|
||||||
- Bind to the local file system by using ${TARGETDIR} as volume in docker-compose.yml
|
|
||||||
- Add instance-global config files by using ${CONFDIR} as volume in docker-compose.yml
|
|
||||||
- Add instance-global custom values inside docker-compose.yml using config:runtime:env
|
|
||||||
- Build service-specific, private docker images from Dockerfiles
|
|
||||||
- Check full instances into any version control system
|
|
|
@ -12,7 +12,15 @@ from kiwi_scp.commands import KiwiCLI
|
||||||
)
|
)
|
||||||
@click.command(cls=KiwiCLI)
|
@click.command(cls=KiwiCLI)
|
||||||
def main(verbose: int) -> None:
|
def main(verbose: int) -> None:
|
||||||
"""kiwi is the simple tool for managing container servers."""
|
"""kiwi is the simple tool for managing container servers.
|
||||||
|
|
||||||
|
\b
|
||||||
|
- Manage full instances using just your favorite version control system
|
||||||
|
- Group services into projects, each with their own docker-compose.yml
|
||||||
|
- Build service-specific, private docker images from Dockerfiles
|
||||||
|
- Make use of the local file system by referring to ${TARGETDIR}, ${TARGETROOT} and ${CONFDIR} in compose files
|
||||||
|
- Create your own instance-global variables for compose files using the kiwi.yml "environment" section
|
||||||
|
"""
|
||||||
|
|
||||||
if verbose >= 2:
|
if verbose >= 2:
|
||||||
log_level = logging.DEBUG
|
log_level = logging.DEBUG
|
||||||
|
|
Loading…
Reference in a new issue