Skip to content

Commit 1ef9ad7

Browse files
committed
shellcompletion
1 parent 1587e1f commit 1ef9ad7

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

wodoo/lib_control.py

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from .tools import ensure_project_name
1313
from .tools import print_prod_env
1414
from .tools import _shell_complete_machines
15+
from .tools import _shell_complete_services
1516

1617

1718
@cli.group(cls=AliasedGroup)
@@ -52,7 +53,9 @@ def ps(config):
5253

5354

5455
@docker.command(name="exec")
55-
@click.argument("machine", required=True)
56+
@click.argument(
57+
"machine", required=True, shell_complete=_shell_complete_machines
58+
)
5659
@click.argument("args", nargs=-1)
5760
@pass_config
5861
def execute(config, machine, args):
@@ -63,7 +66,7 @@ def execute(config, machine, args):
6366

6467

6568
@docker.command(name="kill")
66-
@click.argument("machines", nargs=-1)
69+
@click.argument("machines", nargs=-1, shell_complete=_shell_complete_machines)
6770
@click.option("-b", "--brutal", is_flag=True, help="dont wait")
6871
@click.option("-p", "--profile")
6972
@pass_config
@@ -134,6 +137,7 @@ def remove_volumes(ctx, config, dry_run):
134137

135138
@docker.command()
136139
@pass_config
140+
@click.argument("machine", nargs=-1, shell_complete=_shell_complete_machines)
137141
@click.pass_context
138142
def force_kill(ctx, config, machine):
139143
if config.use_docker:
@@ -162,18 +166,18 @@ def wait_for_port(config, host, port):
162166

163167

164168
@docker.command()
165-
@click.argument("machines", nargs=-1)
169+
@click.argument("machines", nargs=-1, shell_complete=_shell_complete_services)
166170
@pass_config
167171
@click.pass_context
168-
def recreate(ctx, config, machines):
172+
def recreate(ctx, config, machines, shell_complete=_shell_complete_services):
169173
ensure_project_name(config)
170174
if config.use_docker:
171175
from .lib_control_with_docker import recreate as lib_recreate
172176
lib_recreate(ctx, config, machines)
173177

174178

175179
@docker.command()
176-
@click.argument("machines", nargs=-1)
180+
@click.argument("machines", nargs=-1, shell_complete=_shell_complete_services)
177181
@click.option("-d", "--daemon", is_flag=True)
178182
@pass_config
179183
@click.pass_context
@@ -193,7 +197,7 @@ def up(ctx, config, machines, daemon):
193197

194198

195199
@docker.command()
196-
@click.argument("machines", nargs=-1)
200+
@click.argument("machines", nargs=-1, shell_complete=_shell_complete_services)
197201
@click.option("-v", "--volumes", is_flag=True)
198202
@click.option("--remove-orphans", is_flag=True)
199203
@click.option("--postgres-volume", is_flag=True)
@@ -227,7 +231,7 @@ def down(ctx, config, machines, volumes, remove_orphans, postgres_volume):
227231

228232

229233
@docker.command()
230-
@click.argument("machines", nargs=-1)
234+
@click.argument("machines", nargs=-1, shell_complete=_shell_complete_machines)
231235
@pass_config
232236
@click.pass_context
233237
def stop(ctx, config, machines):
@@ -238,7 +242,7 @@ def stop(ctx, config, machines):
238242

239243

240244
@docker.command()
241-
@click.argument("machines", nargs=-1)
245+
@click.argument("machines", nargs=-1, shell_complete=_shell_complete_machines)
242246
@pass_config
243247
@click.pass_context
244248
def rebuild(ctx, config, machines):
@@ -249,7 +253,7 @@ def rebuild(ctx, config, machines):
249253

250254

251255
@docker.command()
252-
@click.argument("machines", nargs=-1)
256+
@click.argument("machines", nargs=-1, shell_complete=_shell_complete_machines)
253257
@click.option("-p", "--profile", default="auto")
254258
@pass_config
255259
@click.pass_context
@@ -261,7 +265,7 @@ def restart(ctx, config, machines, profile):
261265

262266

263267
@docker.command()
264-
@click.argument("machines", nargs=-1)
268+
@click.argument("machines", nargs=-1, shell_complete=_shell_complete_machines)
265269
@click.option("-p", "--profile", default="auto")
266270
@pass_config
267271
@click.pass_context
@@ -273,7 +277,9 @@ def rm(ctx, config, machines, profile):
273277

274278

275279
@docker.command()
276-
@click.argument("machine", required=True)
280+
@click.argument(
281+
"machine", required=True, shell_complete=_shell_complete_machines
282+
)
277283
@pass_config
278284
@click.pass_context
279285
def attach(ctx, config, machine):
@@ -284,7 +290,7 @@ def attach(ctx, config, machine):
284290

285291

286292
@docker.command()
287-
@click.argument("machines", nargs=-1)
293+
@click.argument("machines", nargs=-1, shell_complete=_shell_complete_services)
288294
@click.option("--no-cache", is_flag=True)
289295
@click.option("--pull", is_flag=True)
290296
@click.option("--push", is_flag=True)
@@ -345,7 +351,9 @@ def build(
345351

346352

347353
@docker.command()
348-
@click.argument("machine", required=True)
354+
@click.argument(
355+
"machine", required=True, shell_complete=_shell_complete_services
356+
)
349357
@click.option("-c", "--command", required=False, help="Like /odoolib/debug.py")
350358
@click.option("-p", "--ports", is_flag=True, help="With Port 33284")
351359
@click.option("--port", help="Define the debug port")
@@ -362,7 +370,9 @@ def debug(ctx, config, machine, ports, command, port):
362370

363371

364372
@cli.command()
365-
@click.argument("machine", required=True)
373+
@click.argument(
374+
"machine", required=True, shell_complete=_shell_complete_services
375+
)
366376
@click.argument("args", nargs=-1)
367377
@click.option("-d", "--detached", is_flag=True)
368378
@click.option("-n", "--name")
@@ -378,7 +388,9 @@ def run(ctx, config, machine, detached, name, args, **kwparams):
378388

379389

380390
@cli.command()
381-
@click.argument("machine", required=True)
391+
@click.argument(
392+
"machine", required=True, shell_complete=_shell_complete_services
393+
)
382394
@click.argument("args", nargs=-1)
383395
@pass_config
384396
@click.pass_context

0 commit comments

Comments
 (0)