From a41843c9b2d2c717c579a3d8f093addff5430dfb Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Thu, 21 Oct 2021 10:34:53 +0200 Subject: [PATCH] cleanup --- kiwi_scp/misc.py | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/kiwi_scp/misc.py b/kiwi_scp/misc.py index cfa808b..7b6038e 100644 --- a/kiwi_scp/misc.py +++ b/kiwi_scp/misc.py @@ -16,32 +16,23 @@ class _MultiDecorator: return target -_instance_args = [] +_project_arg = click.argument( + "project", + required=False, + type=click.Path(exists=True), + default=".", +) -instance_command = _MultiDecorator(_instance_args) +_service_arg = click.argument( + "service", + required=False, + type=str, +) -_project_args = [ - *_instance_args, - click.argument( - "project", - required=False, - type=click.Path(exists=True), - default=".", - ), -] +instance_command = _MultiDecorator([]) +project_command = _MultiDecorator([_project_arg]) +service_command = _MultiDecorator([_project_arg, _service_arg]) -project_command = _MultiDecorator(_project_args) - -_service_args = [ - *_project_args, - click.argument( - "service", - required=False, - type=str, - ), -] - -service_command = _MultiDecorator(_service_args) def user_query(description: str, default: Any, cast_to: Type[Any] = str):