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:
|
||||
for name, method in value.steps().items():
|
||||
for name, step in value.steps().items():
|
||||
if isinstance(step, Action):
|
||||
self[modname][name] = cli2.Callable(
|
||||
modname,
|
||||
self.action(value),
|
||||
doc=inspect.getdoc(method),
|
||||
self.action(step),
|
||||
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={
|
||||
option: cli2.Option(option, **cfg)
|
||||
for option, cfg in value.options.items()
|
||||
|
||||
@ -9,6 +9,7 @@ from .localhost import Localhost
|
||||
class Docker(Localhost):
|
||||
"""Manage a docker container."""
|
||||
default_steps = ['install', 'up']
|
||||
contextualize = ['image', 'home']
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.image = kwargs.get('image', 'alpine')
|
||||
@ -53,7 +54,6 @@ class Docker(Localhost):
|
||||
# )
|
||||
# ).out.split('\n')[0]
|
||||
if step('install') and 'install' in self.kwargs:
|
||||
breakpoint()
|
||||
await self.action(self.kwargs['install'], *args, **kwargs)
|
||||
|
||||
if step('rm') and await self.exists():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user