LibrePortal/scripts/cli/cli_initialize.sh
librelad 875a60f90f LibrePortal v0.1.0 — initial release
A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys,
Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun
VPN routing, and a web dashboard to manage it all.

Free & open forever to self-host; optional paid hosted services fund it.
See PROMISE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-21 20:37:54 +01:00

41 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
cliInitialize()
{
cliUpdateCommands;
# Dynamic routing - auto-discover ALL categories!
local category="$initial_command1"
# Handle empty command as help
if [[ -z "$category" ]]; then
category="help"
fi
local commands_file="$install_scripts_dir/cli/commands/$category/cli_${category}_commands.sh"
local header_file="$install_scripts_dir/cli/commands/$category/cli_${category}_header.sh"
# Check if both header and commands files exist
if [[ -f "$commands_file" && -f "$header_file" ]]; then
# Special handling for app category
if [[ "$category" == "app" ]]; then
checkInstallTypeRequirement;
fi
# Source the commands file
source "$commands_file"
# Call the handler function
"cliHandle${category^}Commands"
else
isNotice "Unknown command: ${RED}$category${NC}"
# Show help if command not found
local help_commands_file="$install_scripts_dir/cli/commands/help/cli_help_commands.sh"
if [[ -f "$help_commands_file" ]]; then
source "$help_commands_file"
handleHelpCommands
fi
fi
}