From 3f4c1eaab27c39fcc2748473e6a99799cc6c9582 Mon Sep 17 00:00:00 2001
From: the-sane <3657071+the-sane@users.noreply.github.com>
Date: Tue, 1 Aug 2023 12:04:59 -0400
Subject: [PATCH] Fix url formatting with command-line arguments
---
lug-helper.sh | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/lug-helper.sh b/lug-helper.sh
index bec00a0..0a8e2fe 100755
--- a/lug-helper.sh
+++ b/lug-helper.sh
@@ -2331,6 +2331,15 @@ eac_workaround() {
fi
}
+# Format some URLs for Zenity
+format_urls() {
+ if [ "$use_zenity" -eq 1 ]; then
+ releases_url="$releases_url"
+ lug_wiki="$lug_wiki"
+ lug_wiki_nixos="$lug_wiki_nixos"
+ fi
+}
+
# Get a random Penguin's Star Citizen referral code
referral_randomizer() {
# Populate the referral codes array
@@ -2378,11 +2387,9 @@ fi
# Set defaults
live_or_ptu="$live_dir"
-# Format some URLs for Zenity
-if [ "$use_zenity" -eq 1 ]; then
- releases_url="$releases_url"
- lug_wiki="$lug_wiki"
- lug_wiki_nixos="$lug_wiki_nixos"
+# Format some URLs for Zenity if the Helper was not invoked with command-line arguments (handle those separately below)
+if [ "$#" -eq 0 ]; then
+ format_urls
fi
# Check if a newer verison of the script is available
@@ -2497,6 +2504,9 @@ Usage: lug-helper
shift
done
+ # Format some URLs for Zenity
+ format_urls
+
# Call the requested functions and exit
if [ "${#cargs[@]}" -gt 0 ]; then
for (( x=0; x<"${#cargs[@]}"; x++ )); do