1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-22 21:03:00 +00:00
kiwi-scp/kiwi_scp/scripts/kiwi.py

45 lines
1.4 KiB
Python
Raw Normal View History

import logging
2021-12-02 16:06:13 +00:00
import click
2021-12-03 14:16:53 +00:00
from kiwi_scp.commands import KiwiCLI
2020-08-04 14:52:30 +00:00
2021-12-02 16:21:44 +00:00
@click.option(
"-v", "--verbose",
help="increase output verbosity",
count=True,
)
2021-12-02 16:06:13 +00:00
@click.command(cls=KiwiCLI)
2021-12-02 16:21:44 +00:00
def main(verbose: int) -> None:
2022-01-20 09:55:47 +00:00
"""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
2022-01-24 16:39:55 +00:00
- Make use of the local file system by referring to ${TARGETDIR}, ${TARGETROOT} and ${CONFIGDIR} in compose files
2022-01-20 09:55:47 +00:00
- Create your own instance-global variables for compose files using the kiwi.yml "environment" section
"""
2021-12-02 16:06:13 +00:00
2021-12-02 16:21:44 +00:00
if verbose >= 2:
2020-08-10 12:39:28 +00:00
log_level = logging.DEBUG
log_format = "[%(asctime)s] %(levelname)s @ %(filename)s:%(funcName)s:%(lineno)d: %(message)s"
2021-12-02 16:21:44 +00:00
elif verbose >= 1:
2020-08-10 12:39:28 +00:00
log_level = logging.INFO
log_format = "[%(asctime)s] %(levelname)s: %(message)s"
else:
log_level = logging.WARNING
log_format = "%(levelname)s: %(message)s"
2020-08-13 08:48:01 +00:00
# add a new handler (needed to set the level)
2020-08-10 12:39:28 +00:00
log_handler = logging.StreamHandler()
logging.getLogger().addHandler(log_handler)
2020-08-11 10:08:03 +00:00
2021-12-02 16:06:13 +00:00
logging.getLogger().setLevel(log_level)
log_handler.setFormatter(logging.Formatter(log_format))
2020-08-04 14:52:30 +00:00
if __name__ == "__main__":
main()