Make main.py the main entrypoint again and call docker wrapper enforcement from cli() callback
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
This commit is contained in:
parent
b87fdf722b
commit
d52a615774
3 changed files with 45 additions and 21 deletions
11
main.py
11
main.py
|
@ -9,19 +9,25 @@ from telnet import cmd_telnet
|
|||
from logger import setup_logging, verbose_option
|
||||
import click
|
||||
from config import config, config_option
|
||||
from wrapper import enforce_wrap, nowrapper_option
|
||||
|
||||
|
||||
@click.group()
|
||||
@verbose_option
|
||||
@config_option
|
||||
def cli(verbose: bool = False, config_file: str = None):
|
||||
@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():
|
||||
return cli(prog_name='kupferbootstrap')
|
||||
|
||||
|
||||
cli.add_command(cmd_cache)
|
||||
cli.add_command(cmd_packages)
|
||||
cli.add_command(cmd_image)
|
||||
|
@ -30,3 +36,6 @@ cli.add_command(cmd_flash)
|
|||
cli.add_command(cmd_ssh)
|
||||
cli.add_command(cmd_forwarding)
|
||||
cli.add_command(cmd_telnet)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue