mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-21 20:33:00 +00:00
Removed Clutter
This commit is contained in:
parent
2e37291a68
commit
e7e6e5867a
3 changed files with 6 additions and 11 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue