Merge pull request 'pkgs/cli: machines install handle invalid character' (#4488) from kenji/ke-clan-machines-install-prompt into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4488
This commit is contained in:
Kenji Berthold
2025-07-26 13:29:10 +00:00

View File

@@ -63,9 +63,17 @@ def install_command(args: argparse.Namespace) -> None:
raise ClanError(msg)
if not args.yes:
ask = input(f"Install {args.machine} to {target_host.target}? [y/N] ")
if ask != "y":
return None
while True:
ask = (
input(f"Install {args.machine} to {target_host.target}? [y/N] ")
.strip()
.lower()
)
if ask == "y":
break
if ask == "n" or ask == "":
return None
print(f"Invalid input '{ask}'. Please enter 'y' for yes or 'n' for no.")
if args.identity_file:
target_host = target_host.override(private_key=args.identity_file)