mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-06-25 09:58:21 -04:00
WIP: Improve config parsing, make --verbose and --config-file global options
Bonus: Generalize and reuse cmd_ssh() Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
This commit is contained in:
parent
4cf608eeb6
commit
144acee10f
12 changed files with 122 additions and 104 deletions
12
main.py
12
main.py
|
@ -6,13 +6,21 @@ from flash import cmd_flash
|
|||
from ssh import cmd_ssh
|
||||
from forwarding import cmd_forwarding
|
||||
from telnet import cmd_telnet
|
||||
from logger import setup_logging, verbose_option
|
||||
import click
|
||||
from config import config, config_option
|
||||
|
||||
|
||||
@click.group()
|
||||
def cli():
|
||||
pass
|
||||
@verbose_option
|
||||
@config_option
|
||||
def cli(verbose: bool = False, config_file: str = None):
|
||||
setup_logging(verbose)
|
||||
config.runtime['verbose'] = verbose
|
||||
config.try_load_file(config_file)
|
||||
|
||||
def main():
|
||||
return cli(prog_name='kupferbootstrap')
|
||||
|
||||
cli.add_command(cmd_cache)
|
||||
cli.add_command(cmd_packages)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue