mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-12-25 18:42:59 +00:00
action strings everywhere
This commit is contained in:
parent
93d0b56eb7
commit
fd681418f5
6 changed files with 12 additions and 11 deletions
|
@ -19,7 +19,7 @@ class SubCommand:
|
|||
|
||||
_action = None
|
||||
|
||||
def __init__(self, name, action='', add_parser=True, **kwargs):
|
||||
def __init__(self, name, action, add_parser=True, **kwargs):
|
||||
self.__name = name
|
||||
if add_parser:
|
||||
self._sub_parser = Parser().get_subparsers().add_parser(
|
||||
|
@ -27,12 +27,6 @@ class SubCommand:
|
|||
**kwargs
|
||||
)
|
||||
|
||||
if not action:
|
||||
# default action string
|
||||
self._action = f"Running '{str(self)}' for"
|
||||
else:
|
||||
self._action = action
|
||||
|
||||
def __str__(self):
|
||||
return self.__name
|
||||
|
||||
|
@ -50,7 +44,7 @@ class SubCommand:
|
|||
class ProjectCommand(SubCommand):
|
||||
"""this command concerns a project in current instance"""
|
||||
|
||||
def __init__(self, name, num_projects, action='', add_parser=True, **kwargs):
|
||||
def __init__(self, name, num_projects, action, add_parser=True, **kwargs):
|
||||
super().__init__(
|
||||
name, action=action, add_parser=add_parser,
|
||||
**kwargs
|
||||
|
@ -88,7 +82,7 @@ class ProjectCommand(SubCommand):
|
|||
class ServiceCommand(ProjectCommand):
|
||||
"""this command concerns service(s) in a project"""
|
||||
|
||||
def __init__(self, name, num_projects, num_services, action='', add_parser=True, **kwargs):
|
||||
def __init__(self, name, num_projects, num_services, action, add_parser=True, **kwargs):
|
||||
super().__init__(
|
||||
name, num_projects=num_projects, action=action, add_parser=add_parser,
|
||||
**kwargs
|
||||
|
@ -96,7 +90,7 @@ class ServiceCommand(ProjectCommand):
|
|||
|
||||
if (isinstance(num_projects, str) and num_projects == '*') \
|
||||
or (isinstance(num_projects, int) and num_projects > 1):
|
||||
logging.warning(f"Invalid choice for project count: {num_projects}")
|
||||
raise ValueError(f"Invalid choice for project count: {num_projects}")
|
||||
|
||||
if num_services == 1:
|
||||
services = "a service"
|
||||
|
|
|
@ -19,6 +19,7 @@ class ConfCopyCommand(SubCommand):
|
|||
def __init__(self):
|
||||
super().__init__(
|
||||
'conf-copy',
|
||||
action="Syncing all configs for",
|
||||
description="Synchronize all config files to target directory"
|
||||
)
|
||||
|
||||
|
@ -46,6 +47,7 @@ class ConfPurgeCommand(SubCommand):
|
|||
def __init__(self):
|
||||
super().__init__(
|
||||
'conf-purge',
|
||||
action="Removing all configs for",
|
||||
description="Remove all config files in target directory"
|
||||
)
|
||||
|
||||
|
@ -66,6 +68,7 @@ class ConfCleanCommand(SubCommand):
|
|||
def __init__(self):
|
||||
super().__init__(
|
||||
'conf-clean',
|
||||
action="Cleaning all configs for",
|
||||
description="Cleanly sync all configs to target folder, relaunch affected projects"
|
||||
)
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ class InitCommand(SubCommand):
|
|||
def __init__(self):
|
||||
super().__init__(
|
||||
'init',
|
||||
action="Creating",
|
||||
description="Create a new kiwi-config instance"
|
||||
)
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class NetUpCommand(SubCommand):
|
|||
def __init__(self):
|
||||
super().__init__(
|
||||
'net-up',
|
||||
action="Creating the local network hub",
|
||||
action="Creating the local network hub for",
|
||||
description="Create the local network hub for this instance"
|
||||
)
|
||||
|
||||
|
@ -63,6 +63,7 @@ class NetDownCommand(SubCommand):
|
|||
def __init__(self):
|
||||
super().__init__(
|
||||
'net-down',
|
||||
action="Removing the local network hub for",
|
||||
description="Remove the local network hub for this instance"
|
||||
)
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@ class ShCommand(ServiceCommand):
|
|||
def __init__(self):
|
||||
super().__init__(
|
||||
'sh', num_projects=1, num_services=1,
|
||||
action="Spawning shell in",
|
||||
description="Spawn shell inside a project's service"
|
||||
)
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ class ShowCommand(SubCommand):
|
|||
def __init__(self):
|
||||
super().__init__(
|
||||
'show',
|
||||
action="Printing",
|
||||
description="Show effective kiwi.yml"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue