parchbootstrap/main.py
InsanePrawn f09deaa9a5 a lot: profiles, some more help strings. partial: exceptions instead of exit()
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
2021-09-29 02:00:59 +02:00

46 lines
1.2 KiB
Python

from packages import cmd_packages
from cache import cmd_cache
from image import cmd_image
from boot import cmd_boot
from flash import cmd_flash
from ssh import cmd_ssh
from forwarding import cmd_forwarding
from telnet import cmd_telnet
from logger import logging, setup_logging, verbose_option, get_trace
import click
from config import config, config_option
from wrapper import enforce_wrap, nowrapper_option
@click.group()
@verbose_option
@config_option
@nowrapper_option
def cli(verbose: bool = False, config_file: str = None, no_wrapper: bool = False):
setup_logging(verbose)
config.runtime['verbose'] = verbose
config.try_load_file(config_file)
# TODO: move this only to CMDs where it's needed
enforce_wrap(no_wrapper=no_wrapper)
def main():
try:
return cli(prog_name='kupferbootstrap')
except Exception as err:
logging.debug(get_trace())
logging.fatal(err)
exit(1)
cli.add_command(cmd_cache)
cli.add_command(cmd_packages)
cli.add_command(cmd_image)
cli.add_command(cmd_boot)
cli.add_command(cmd_flash)
cli.add_command(cmd_ssh)
cli.add_command(cmd_forwarding)
cli.add_command(cmd_telnet)
if __name__ == '__main__':
main()