flash: improve prompt if no disk is specified

This commit is contained in:
Jörg Thalheim 2024-04-03 11:51:21 +02:00
parent 1c1c143b8d
commit f7077e3540

View File

@ -103,7 +103,11 @@ def flash_command(args: argparse.Namespace) -> None:
machine = Machine(opts.machine, flake=opts.flake)
if opts.confirm and not opts.dry_run:
disk_str = ", ".join(f"{name}={device}" for name, device in opts.disks.items())
ask = input(f"Install {machine.name} to {disk_str}? [y/N] ")
msg = f"Install {machine.name}"
if disk_str != "":
msg += f" to {disk_str}"
msg += "? [y/N] "
ask = input(msg)
if ask != "y":
return
flash_machine(machine, disks=opts.disks, dry_run=opts.dry_run, debug=opts.debug)