From fb0193e0f05e20419b3222b35cf9b7e2b4a67069 Mon Sep 17 00:00:00 2001 From: Candifloss Date: Thu, 23 Jul 2026 20:08:04 +0530 Subject: [PATCH] Fix: `create_template` --- .../functions/create_template.fish | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/modules/proxmox_host/functions/create_template.fish b/modules/proxmox_host/functions/create_template.fish index 1ea32f9..6e4a7b2 100644 --- a/modules/proxmox_host/functions/create_template.fish +++ b/modules/proxmox_host/functions/create_template.fish @@ -14,29 +14,29 @@ function create_template --description "Create a Debian cloud-init template" echo "Proxmox Debian Template Creator" echo - # Required values - - if test -z "$vmid" - read -l -P "Template ID: " vmid - end + # Required arguments if test -z "$vmid" - echo "Error: Template ID is required." - return 1 + read -P "Template ID: " vmid + + if test -z "$vmid" + echo "Error: Template ID is required." + return 1 + end end if test -z "$name" echo "Example: debian13tmpl" - read -l -P "Template Name: " name + read -P "Template Name: " name + + if test -z "$name" + echo "Error: Template name is required." + return 1 + end end - if test -z "$name" - echo "Error: Template name is required." - return 1 - end + # Optional arguments - # Optional values with configured defaults - test -n "$bridge"; or set bridge $VM_TEMPLATE_BRIDGE test -n "$image"; or set image $VM_TEMPLATE_IMAGE test -n "$storage"; or set storage $VM_TEMPLATE_STORAGE @@ -56,11 +56,12 @@ function create_template --description "Create a Debian cloud-init template" return 1 end - # Prompt for bridge if it wasn't supplied - + # Allow bridge override interactively + if test -z "$argv[3]" set -l options (string join "/" $VM_TEMPLATE_BRIDGES) - read -l -P "Bridge [$options]: " tmp + + read -P "Bridge [$options]: " tmp if test -n "$tmp" set bridge $tmp @@ -75,15 +76,15 @@ function create_template --description "Create a Debian cloud-init template" echo "Storage: $storage" echo - read -l -P "Continue? [y/N]: " confirm + read -P "Continue? [y/N]: " confirm - if test "$confirm" != y + if test (string lower -- "$confirm") != y echo "Aborted." return 1 end qm create $vmid \ - --name $name \ + --name "$name" \ --ostype l26 \ --machine q35 \ --cpu host \