From 03cd4467f6647cf59f5650724624d5a76374636e Mon Sep 17 00:00:00 2001 From: leonfairrow Date: Wed, 16 Sep 2026 18:38:39 +0200 Subject: [PATCH 1/8] sources automatically gathers .sh --- script-dialog.sh | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/script-dialog.sh b/script-dialog.sh index ef15cca..1150d35 100755 --- a/script-dialog.sh +++ b/script-dialog.sh @@ -6,27 +6,7 @@ # Get the directory where this script is located SCRIPT_DIALOG_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -# Source all modular components -# shellcheck source=./init.sh -source "${SCRIPT_DIALOG_DIR}/init.sh" - -# shellcheck source=./helpers.sh -source "${SCRIPT_DIALOG_DIR}/helpers.sh" - -# shellcheck source=./messages.sh -source "${SCRIPT_DIALOG_DIR}/messages.sh" - -# shellcheck source=./inputs.sh -source "${SCRIPT_DIALOG_DIR}/inputs.sh" - -# shellcheck source=./lists.sh -source "${SCRIPT_DIALOG_DIR}/lists.sh" - -# shellcheck source=./progressbar.sh -source "${SCRIPT_DIALOG_DIR}/progressbar.sh" - -# shellcheck source=./pickers.sh -source "${SCRIPT_DIALOG_DIR}/pickers.sh" - -# shellcheck source=./datepicker.sh -source "${SCRIPT_DIALOG_DIR}/datepicker.sh" +for src in "$SCRIPT_DIALOG_DIR"/*.sh +do + source "$src" +done From a7980d77839c21fbeb4bc30a2d076b07f58fd7f5 Mon Sep 17 00:00:00 2001 From: leonfairrow <253990460+leonclifford@users.noreply.github.com> Date: Wed, 16 Sep 2026 19:41:22 +0200 Subject: [PATCH 2/8] fixed: automatic source --- script-dialog.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/script-dialog.sh b/script-dialog.sh index 1150d35..6ece53e 100755 --- a/script-dialog.sh +++ b/script-dialog.sh @@ -3,10 +3,14 @@ # https://github.com/lunarcloud/script-dialog # LGPL-2.1 license -# Get the directory where this script is located +# get the directories SCRIPT_DIALOG_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +CURRENT_FILE="$(realpath -- "${BASH_SOURCE[0]}")" -for src in "$SCRIPT_DIALOG_DIR"/*.sh +#sources everything, excludes current file +for src in ./*.sh do - source "$src" + [[ "$(realpath -- "$src")" == "$CURRENT_FILE" ]] && continue + source "$src" || exit 1 + echo "$src" done From ed4efb8745d2c049c9e03cc50eabee04cfb66922 Mon Sep 17 00:00:00 2001 From: leonfairrow <253990460+leonclifford@users.noreply.github.com> Date: Wed, 16 Sep 2026 20:02:09 +0200 Subject: [PATCH 3/8] datepicker month string on array --- datepicker.sh | 34 +++++++++------------------------- script-dialog.sh | 3 +++ 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/datepicker.sh b/datepicker.sh index aaf3f19..a93f118 100644 --- a/datepicker.sh +++ b/datepicker.sh @@ -29,6 +29,14 @@ # RETURN: # 0 if success, non-zero otherwise. ####################################### + +# declare month array +declare -A month=( + [Jan]=1 [Feb]=2 [Mar]=3 [Apr]=4 + [May]=5 [Jun]=6 [Jul]=7 [Aug]=8 + [Sep]=9 [Oct]=10 [Nov]=11 [Dec]=12 +) + function datepicker() { if [ -z ${GUI_ICON+x} ]; then GUI_ICON=$XDG_ICO_CALENDAR @@ -62,31 +70,7 @@ function datepicker() { INPUT_DATE=$(kdialog --title="$GUI_TITLE" --icon "$GUI_ICON" --calendar "Select Date") exit_status=$? TEXT_MONTH=$(echo "$INPUT_DATE" | cut -d' ' -f2) - if [ "$TEXT_MONTH" == "Jan" ]; then - MONTH=1 - elif [ "$TEXT_MONTH" == "Feb" ]; then - MONTH=2 - elif [ "$TEXT_MONTH" == "Mar" ]; then - MONTH=3 - elif [ "$TEXT_MONTH" == "Apr" ]; then - MONTH=4 - elif [ "$TEXT_MONTH" == "May" ]; then - MONTH=5 - elif [ "$TEXT_MONTH" == "Jun" ]; then - MONTH=6 - elif [ "$TEXT_MONTH" == "Jul" ]; then - MONTH=7 - elif [ "$TEXT_MONTH" == "Aug" ]; then - MONTH=8 - elif [ "$TEXT_MONTH" == "Sep" ]; then - MONTH=9 - elif [ "$TEXT_MONTH" == "Oct" ]; then - MONTH=10 - elif [ "$TEXT_MONTH" == "Nov" ]; then - MONTH=11 - else #elif [ "$TEXT_MONTH" == "Dec" ]; then - MONTH=12 - fi + MONTH=${month["$TEXT_MONTH"]:-0} DAY=$(echo "$INPUT_DATE" | cut -d' ' -f3) YEAR=$(echo "$INPUT_DATE" | cut -d' ' -f4) diff --git a/script-dialog.sh b/script-dialog.sh index 6ece53e..f19df87 100755 --- a/script-dialog.sh +++ b/script-dialog.sh @@ -14,3 +14,6 @@ do source "$src" || exit 1 echo "$src" done + +# the rest goes there +datepicker From 195b07605956a99f0f5e6e1155d018bf1ae6efeb Mon Sep 17 00:00:00 2001 From: leonfairrow <253990460+leonclifford@users.noreply.github.com> Date: Thu, 17 Sep 2026 08:25:57 +0200 Subject: [PATCH 4/8] sources automatically --- script-dialog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script-dialog.sh b/script-dialog.sh index f19df87..7ee4dd4 100755 --- a/script-dialog.sh +++ b/script-dialog.sh @@ -7,7 +7,7 @@ SCRIPT_DIALOG_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" CURRENT_FILE="$(realpath -- "${BASH_SOURCE[0]}")" -#sources everything, excludes current file +# sources everything, excludes current file for src in ./*.sh do [[ "$(realpath -- "$src")" == "$CURRENT_FILE" ]] && continue From d44565f0c43883238cdf02f58021cce791f861f5 Mon Sep 17 00:00:00 2001 From: leonfairrow <253990460+leonclifford@users.noreply.github.com> Date: Thu, 17 Sep 2026 09:04:44 +0200 Subject: [PATCH 5/8] functions can be executed via prompt --- script-dialog.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/script-dialog.sh b/script-dialog.sh index 7ee4dd4..2885e6d 100755 --- a/script-dialog.sh +++ b/script-dialog.sh @@ -7,7 +7,7 @@ SCRIPT_DIALOG_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" CURRENT_FILE="$(realpath -- "${BASH_SOURCE[0]}")" -# sources everything, excludes current file +# sources everything in folder, excludes current file for src in ./*.sh do [[ "$(realpath -- "$src")" == "$CURRENT_FILE" ]] && continue @@ -15,5 +15,12 @@ do echo "$src" done +# execute told function +if declare -f "$1" >/dev/null; then + "$1" +else + echo "Function not found" +fi + # the rest goes there -datepicker + From e7b650529ebb510fd70a7dc801b79a8d962d4904 Mon Sep 17 00:00:00 2001 From: leonfairrow <253990460+leonclifford@users.noreply.github.com> Date: Thu, 17 Sep 2026 10:45:49 +0200 Subject: [PATCH 6/8] auto detect function fixed --- script-dialog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script-dialog.sh b/script-dialog.sh index 2885e6d..5e3bd86 100755 --- a/script-dialog.sh +++ b/script-dialog.sh @@ -12,7 +12,7 @@ for src in ./*.sh do [[ "$(realpath -- "$src")" == "$CURRENT_FILE" ]] && continue source "$src" || exit 1 - echo "$src" + #echo "$src" done # execute told function From 90c0353ef2d54b3666fd4fe27d8d59e9ea5838ed Mon Sep 17 00:00:00 2001 From: leonfairrow <253990460+leonclifford@users.noreply.github.com> Date: Thu, 17 Sep 2026 10:46:25 +0200 Subject: [PATCH 7/8] listfunc created --- helpers.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/helpers.sh b/helpers.sh index 3cbdf28..8be58e9 100644 --- a/helpers.sh +++ b/helpers.sh @@ -6,6 +6,15 @@ # Variables set in init.sh and used here # shellcheck disable=SC2154 +function listfunc() { + +for file in *.sh +do + echo "$file" +done + +} + ####################################### # Attempts to run a privileged command (sudo or equivalent) # GLOBALS: @@ -19,6 +28,7 @@ # RETURN: # 0 if success, non-zero otherwise. ####################################### + function superuser() { if [ "$NO_SUDO" == true ]; then (>&2 echo "${red}No sudo available!${normal}") @@ -41,7 +51,7 @@ function superuser() { ####################################### # Set the GUI_TITLE based on the ACTIVITY and APP_NAME # GLOBALS: -# GUI_TITLE +# GUI_TITLE # ACTIVITY # APP_NAME # ARGUMENTS: From b6a0f543672ef72dd8ae407ef4bc7c05a999021b Mon Sep 17 00:00:00 2001 From: leonfairrow <253990460+leonclifford@users.noreply.github.com> Date: Thu, 17 Sep 2026 11:23:40 +0200 Subject: [PATCH 8/8] listfunc fixed --- helpers.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/helpers.sh b/helpers.sh index 8be58e9..694000f 100644 --- a/helpers.sh +++ b/helpers.sh @@ -7,12 +7,7 @@ # shellcheck disable=SC2154 function listfunc() { - -for file in *.sh -do - echo "$file" -done - + compgen -A function } #######################################