clan: add dynamic completions to clan vms run

This commit is contained in:
a-kenji 2024-06-04 15:48:12 +02:00
parent 05ff7bd261
commit 21ac1f7204

View File

@ -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__))