Guess who's going out of the rabbithole
This commit is contained in:
parent
85e11755f7
commit
6b15838059
21
shlax/cli.py
21
shlax/cli.py
@ -116,11 +116,26 @@ class ConsoleScript(cli2.ConsoleScript):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
for name, method in value.steps().items():
|
for name, step in value.steps().items():
|
||||||
|
if isinstance(step, Action):
|
||||||
self[modname][name] = cli2.Callable(
|
self[modname][name] = cli2.Callable(
|
||||||
modname,
|
modname,
|
||||||
self.action(value),
|
self.action(step),
|
||||||
doc=inspect.getdoc(method),
|
doc=inspect.getdoc(step),
|
||||||
|
options={
|
||||||
|
option: cli2.Option(option, **cfg)
|
||||||
|
for option, cfg in value.options.items()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# should be a method, just clone the
|
||||||
|
# original action and replace default_steps
|
||||||
|
action = copy.deepcopy(value)
|
||||||
|
action.default_steps = [name]
|
||||||
|
self[modname][name] = cli2.Callable(
|
||||||
|
modname,
|
||||||
|
self.action(action),
|
||||||
|
doc=inspect.getdoc(step),
|
||||||
options={
|
options={
|
||||||
option: cli2.Option(option, **cfg)
|
option: cli2.Option(option, **cfg)
|
||||||
for option, cfg in value.options.items()
|
for option, cfg in value.options.items()
|
||||||
|
|||||||
@ -9,6 +9,7 @@ from .localhost import Localhost
|
|||||||
class Docker(Localhost):
|
class Docker(Localhost):
|
||||||
"""Manage a docker container."""
|
"""Manage a docker container."""
|
||||||
default_steps = ['install', 'up']
|
default_steps = ['install', 'up']
|
||||||
|
contextualize = ['image', 'home']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.image = kwargs.get('image', 'alpine')
|
self.image = kwargs.get('image', 'alpine')
|
||||||
@ -53,7 +54,6 @@ class Docker(Localhost):
|
|||||||
# )
|
# )
|
||||||
# ).out.split('\n')[0]
|
# ).out.split('\n')[0]
|
||||||
if step('install') and 'install' in self.kwargs:
|
if step('install') and 'install' in self.kwargs:
|
||||||
breakpoint()
|
|
||||||
await self.action(self.kwargs['install'], *args, **kwargs)
|
await self.action(self.kwargs['install'], *args, **kwargs)
|
||||||
|
|
||||||
if step('rm') and await self.exists():
|
if step('rm') and await self.exists():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user