From 21ac1f72040a7fbb29f7f2071df5bf82cfd26d78 Mon Sep 17 00:00:00 2001 From: a-kenji Date: Tue, 4 Jun 2024 15:48:12 +0200 Subject: [PATCH] clan: add dynamic completions to `clan vms run` --- pkgs/clan-cli/clan_cli/vms/run.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/clan-cli/clan_cli/vms/run.py b/pkgs/clan-cli/clan_cli/vms/run.py index db4f10df..9153d192 100644 --- a/pkgs/clan-cli/clan_cli/vms/run.py +++ b/pkgs/clan-cli/clan_cli/vms/run.py @@ -7,6 +7,7 @@ from contextlib import ExitStack from pathlib import Path from tempfile import TemporaryDirectory +from ..completions import add_dynamic_completer, complete_machines from ..cmd import Log, run from ..dirs import module_root, user_cache_dir, vm_state_dir from ..errors import ClanError @@ -205,5 +206,8 @@ def run_command( def register_run_parser(parser: argparse.ArgumentParser) -> None: - parser.add_argument("machine", type=str, help="machine in the flake to run") + machine_action = parser.add_argument( + "machine", type=str, help="machine in the flake to run" + ) + add_dynamic_completer(machine_action, complete_machines) parser.set_defaults(func=lambda args: run_command(**args.__dict__))