fix: 修复远程部署脚本命令解析
This commit is contained in:
@@ -79,6 +79,14 @@ def ask_secret(prompt: str, default: str = "") -> str:
|
||||
return value or default
|
||||
|
||||
|
||||
def ask_required_secret(prompt: str) -> str:
|
||||
while True:
|
||||
value = getpass.getpass(f"{prompt}: ").strip()
|
||||
if value:
|
||||
return value
|
||||
log("该项不能为空,请重新输入。")
|
||||
|
||||
|
||||
def ask_yes_no(prompt: str, default: bool = True) -> bool:
|
||||
hint = "Y/n" if default else "y/N"
|
||||
value = input(f"{prompt}({hint}): ").strip().lower()
|
||||
@@ -141,7 +149,7 @@ def ask_config() -> DeployConfig:
|
||||
ssh_host = ask("服务器 SSH IP/域名")
|
||||
ssh_port = int(ask("服务器 SSH 端口", "22"))
|
||||
ssh_username = ask("服务器 SSH 账号", "root")
|
||||
ssh_password = ask_secret("服务器 SSH 密码")
|
||||
ssh_password = ask_required_secret("服务器 SSH 密码")
|
||||
|
||||
return DeployConfig(
|
||||
admin_url=admin_url,
|
||||
@@ -176,7 +184,11 @@ def ask_config() -> DeployConfig:
|
||||
|
||||
def run_cmd(args: list[str], cwd: Path | None = None) -> None:
|
||||
log("$ " + " ".join(shlex.quote(str(item)) for item in args))
|
||||
subprocess.run(args, cwd=str(cwd or ROOT), check=True)
|
||||
resolved_args = args[:]
|
||||
executable = shutil.which(resolved_args[0])
|
||||
if executable:
|
||||
resolved_args[0] = executable
|
||||
subprocess.run(resolved_args, cwd=str(cwd or ROOT), check=True)
|
||||
|
||||
|
||||
def remove_dir(path: Path) -> None:
|
||||
|
||||
Reference in New Issue
Block a user