From 829938e44fdbd397642a94119e7c6715cec86763 Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Fri, 29 Oct 2021 13:37:59 +0200 Subject: [PATCH] move pass_instance decorator --- kiwi_scp/commands/cli.py | 5 +++++ kiwi_scp/commands/cmd_init.py | 3 ++- kiwi_scp/instance.py | 3 --- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/kiwi_scp/commands/cli.py b/kiwi_scp/commands/cli.py index 2d1d52d..165f1b4 100644 --- a/kiwi_scp/commands/cli.py +++ b/kiwi_scp/commands/cli.py @@ -2,6 +2,8 @@ import os import click +from ..instance import Instance + class KiwiCLI(click.MultiCommand): """Command Line Interface spread over multiple files in this directory""" @@ -23,3 +25,6 @@ class KiwiCLI(click.MultiCommand): except ImportError: return return mod.cmd + + +pass_instance = click.make_pass_decorator(Instance, ensure=True) diff --git a/kiwi_scp/commands/cmd_init.py b/kiwi_scp/commands/cmd_init.py index edae74e..69a322e 100644 --- a/kiwi_scp/commands/cmd_init.py +++ b/kiwi_scp/commands/cmd_init.py @@ -5,9 +5,10 @@ from pathlib import Path import click +from .cli import pass_instance from .._constants import KIWI_CONF_NAME from ..config import KiwiConfig -from ..instance import Instance, pass_instance +from ..instance import Instance from ..misc import user_query diff --git a/kiwi_scp/instance.py b/kiwi_scp/instance.py index da8c2eb..1a27ff0 100644 --- a/kiwi_scp/instance.py +++ b/kiwi_scp/instance.py @@ -84,6 +84,3 @@ class Instance: for service in services if service.name in service_names ]) - - -pass_instance = click.make_pass_decorator(Instance, ensure=True)