make help better

This commit is contained in:
fatalerrors
2026-05-07 11:53:28 +02:00
parent e64a857a43
commit 9a089112c3

View File

@@ -36,9 +36,21 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Display list of commands and general informations # Display list of commands and general informations
# Usage: help # Usage: help [command]
help() help()
{ {
# If a command name is given, delegate to its --help output.
if [[ $# -gt 0 && "$1" != "--help" && "$1" != "-h" ]]; then
local cmd="$1"
if declare -F "$cmd" >/dev/null 2>&1 || command -v "$cmd" >/dev/null 2>&1; then
"$cmd" --help
else
disp E "Unknown command: $cmd"
return 1
fi
return
fi
# shellcheck disable=SC2154 # color code in disp.sh # shellcheck disable=SC2154 # color code in disp.sh
# shellcheck disable=SC2059 # printf format is a color variable # shellcheck disable=SC2059 # printf format is a color variable
printf "${BIWhite}Welcome to your profile! Here is a list of available commands:${DEFAULTCOL}\n\n" printf "${BIWhite}Welcome to your profile! Here is a list of available commands:${DEFAULTCOL}\n\n"