diff --git a/kiwi_scp/commands/cli.py b/kiwi_scp/commands/cli.py index 84ebbd1..3c3feef 100644 --- a/kiwi_scp/commands/cli.py +++ b/kiwi_scp/commands/cli.py @@ -5,7 +5,7 @@ from typing import List, Tuple, Iterable, Any, Type import click -from ..instance import Instance, Project, Services +from ..instance import Instance, Project class KiwiCLI(click.MultiCommand): @@ -83,7 +83,7 @@ class KiwiCommand: @classmethod def run_for_new_project(cls, instance: Instance, project_name: str, **kwargs) -> None: - raise Exception + cls.print_error(f"Project '{project_name}' not in kiwi-scp instance at '{instance.directory}'!") @classmethod def run_for_existing_project(cls, instance: Instance, project: Project, **kwargs) -> None: diff --git a/kiwi_scp/commands/cmd_init.py b/kiwi_scp/commands/cmd_init.py index 848c6aa..428a011 100644 --- a/kiwi_scp/commands/cmd_init.py +++ b/kiwi_scp/commands/cmd_init.py @@ -38,7 +38,7 @@ class CMD(KiwiCommand): """Initialize or reconfigure a kiwi-scp instance""" @classmethod - def run_for_instance(cls, instance: Instance, output: Path = None, force: bool = None, **kwargs) -> None: + def run_for_instance(cls, instance: Instance, output: Path = None, force: bool = None) -> None: if output is not None: instance.directory = output diff --git a/kiwi_scp/commands/cmd_list.py b/kiwi_scp/commands/cmd_list.py index ac6b420..ffd3e20 100644 --- a/kiwi_scp/commands/cmd_list.py +++ b/kiwi_scp/commands/cmd_list.py @@ -21,7 +21,7 @@ class CMD(KiwiCommand): """List projects in this instance, services inside a project or service(s) inside a project""" @classmethod - def run_for_instance(cls, instance: Instance, show: bool = None, **kwargs) -> None: + def run_for_instance(cls, instance: Instance, show: bool = None) -> None: if show: KiwiCommand.print_header(f"Showing config for kiwi-scp instance at '{instance.directory}'.") click.echo_via_pager(instance.config.kiwi_yml) @@ -34,7 +34,7 @@ class CMD(KiwiCommand): ) @classmethod - def run_for_existing_project(cls, instance: Instance, project: Project, show: bool = None, **kwargs) -> None: + def run_for_existing_project(cls, instance: Instance, project: Project, show: bool = None) -> None: if show: KiwiCommand.print_header(f"Showing config for all services in project '{project.name}'.") click.echo_via_pager(str(project.services)) @@ -44,12 +44,7 @@ class CMD(KiwiCommand): KiwiCommand.print_list(service.name for service in project.services.content) @classmethod - def run_for_new_project(cls, instance: Instance, project_name: str, **kwargs) -> None: - KiwiCommand.print_error(f"Project '{project_name}' not in kiwi-scp instance at '{instance.directory}'!") - - @classmethod - def run_for_services(cls, instance: Instance, project: Project, service_names: List[str], show: bool = None, - **kwargs) -> None: + def run_for_services(cls, instance: Instance, project: Project, service_names: List[str], show: bool = None) -> None: services = project.services.filter_existing(service_names) if show: service_names = [service.name for service in services.content]