diff options
Diffstat (limited to 'apps/installer/includes/config/config.sh')
| -rw-r--r-- | apps/installer/includes/config/config.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/apps/installer/includes/config/config.sh b/apps/installer/includes/config/config.sh new file mode 100644 index 0000000000..40192c4008 --- /dev/null +++ b/apps/installer/includes/config/config.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +CURRENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd ) + +# shellcheck source=../../../bash_shared/includes.sh +source "$CURRENT_PATH/../../../bash_shared/includes.sh" +# shellcheck source=../includes.sh +source "$CURRENT_PATH/../includes.sh" +# shellcheck source=../../../bash_shared/menu_system.sh +source "$AC_PATH_APPS/bash_shared/menu_system.sh" + +function acore_dash_configShowValue() { + if [ $# -ne 1 ]; then + echo "Usage: show <VAR_NAME>" + return 1 + fi + + local varName="$1" + local varValue="${!varName}" + if [ -z "$varValue" ]; then + echo "$varName is not set." + else + echo "$varName=$varValue" + fi +} + +function acore_dash_configLoad() { + acore_common_loadConfig + echo "Configuration loaded into the current shell session." +} + +# Configuration management menu definition +# Format: "key|short|description" +config_menu_items=( + "show|s|Show configuration variable value" + "load|l|Load configurations variables within the current shell session" + "help|h|Show detailed help" + "quit|q|Close this menu" +) + +# Menu command handler for configuration operations +function handle_config_command() { + local key="$1" + shift + + case "$key" in + "show") + acore_dash_configShowValue "$@" + ;; + "load") + acore_dash_configLoad + ;; + esac +} + +function acore_dash_config() { + menu_run_with_items "CONFIG MANAGER" handle_config_command -- "${config_menu_items[@]}" -- "$@" + return $? +} + |
