]> Untitled Git - hvutilities.git/commitdiff
hvk: hvk-select: autocompute width
authorHugo Villeneuve <hugo@hugovil.com>
Wed, 25 Feb 2026 19:47:27 +0000 (14:47 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Mon, 23 Mar 2026 18:31:16 +0000 (14:31 -0400)
Signed-off-by: Hugo Villeneuve <hugo@hugovil.com>
scripts/hvk-select.sh

index 2f121bb6b61925dab6c466a24d1953604d2abc02..7a3327b61910bd10ecf2cd4004b589e7f3db095f 100755 (executable)
@@ -16,12 +16,19 @@ file=()
 count=0
 list=""
 i=1
+width=0
+prefix_width=15
 
 # Loop over source folder and add files to array
 while IFS= read -r -d $'\0' file; do
     f="$(basename ${file})"
     file+=("${f}")
 
+    len=${#f}
+    if [ "${len}" -gt ${width} ]; then
+       width="${len}"
+    fi
+
     status="off"
 
     set +e
@@ -47,7 +54,7 @@ if [ ${count} -eq 0 ]; then
 fi
 
 rows=$((${count} + 7))
-width=40
+width=$((${prefix_width} + ${width}))
 
 dialog --radiolist "HVK board selection" ${rows} ${width} ${count} ${list} 2> ${dialog_outfile}