feat(prepare-win): add --gui/--nogui flag, default headless

Lets `template prepare-win` start the template VM in the Workstation
window (--gui) for interactive debugging; defaults to headless --nogui.
This commit is contained in:
2026-06-09 00:20:49 +02:00
parent a0497ffa4e
commit cd88dec15d
+7 -2
View File
@@ -386,6 +386,9 @@ def _run_with_heartbeat(
help="Keyring target name for the stored credential.")
@click.option("--recreate-snapshot", is_flag=True,
help="Delete and recreate the snapshot if it already exists (no prompt).")
@click.option("--gui/--nogui", "gui", default=False, show_default=True,
help="Start the VM with the Workstation window (--gui, needs an X display) "
"or headless (--nogui, the default).")
def template_prepare_win(
vmx: str,
guest_ip: str,
@@ -403,6 +406,7 @@ def template_prepare_win(
store_credential: bool,
credential_target: str,
recreate_snapshot: bool,
gui: bool,
) -> None:
"""Provision a Windows template VM via pypsrp (Linux-host compatible).
@@ -466,8 +470,9 @@ def template_prepare_win(
handle = VmHandle(identifier=str(vmx_path), name=vmx_path.stem)
if not backend.is_running(handle):
click.echo(f"[prepare-win] Starting VM: {vmx_path.name} ...")
backend.start(handle, headless=True)
mode = "GUI" if gui else "headless"
click.echo(f"[prepare-win] Starting VM ({mode}): {vmx_path.name} ...")
backend.start(handle, headless=not gui)
else:
click.echo(f"[prepare-win] VM already running: {vmx_path.name}")