help bug fix
This commit is contained in:
+24
-9
@@ -39,11 +39,19 @@
|
||||
# Usage: help [command]
|
||||
help()
|
||||
{
|
||||
# If a command name is given, delegate to its --help output.
|
||||
# With a command name, delegate to its own --help output. Only shell
|
||||
# functions are accepted: running an arbitrary external program with an
|
||||
# option it may not understand could have side effects.
|
||||
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
|
||||
if [[ $cmd == -* ]]; then
|
||||
disp E "Invalid option: $cmd. Usage: help [command]"
|
||||
return 1
|
||||
elif declare -F -- "$cmd" >/dev/null 2>&1; then
|
||||
"$cmd" --help
|
||||
elif command -v -- "$cmd" >/dev/null 2>&1; then
|
||||
disp E "'$cmd' is not a profile command: try \"$cmd --help\" or \"man $cmd\"."
|
||||
return 1
|
||||
else
|
||||
disp E "Unknown command: $cmd"
|
||||
return 1
|
||||
@@ -51,9 +59,13 @@ help()
|
||||
return
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2154 # color code in disp.sh
|
||||
# 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"
|
||||
# Bold title, without colour codes when NO_COLOR is set (like disp does)
|
||||
if [[ -n ${NO_COLOR:-} ]]; then
|
||||
printf "Welcome to your profile! Here is a list of available commands:\n\n"
|
||||
else
|
||||
printf "%b%s%b\n\n" "$BIWhite" \
|
||||
"Welcome to your profile! Here is a list of available commands:" "$DEFAULTCOL"
|
||||
fi
|
||||
printf "busy\t\tMonitor /dev/urandom for a hex pattern — look busy\n"
|
||||
printf "check_updates\tCheck for new versions of profile\n"
|
||||
printf "clean\t\tErase backup files in given directories, optionally recursive\n"
|
||||
@@ -70,22 +82,25 @@ help()
|
||||
printf "gacp\t\tAdd, commit and push changes (auto-pull if needed)\n"
|
||||
printf "genpwd\t\tGenerate one or more random secure passwords with configurable constraints\n"
|
||||
printf "ggraph\t\tDisplay decorated git history graph\n"
|
||||
printf "gpid\t\tGive the list of PIDs matching the given process name(s)\n"
|
||||
printf "gprune\t\tDelete local branches already merged, or after remote deletion (MR / PR)\n"
|
||||
printf "greset\t\tReset branch to upstream (stash local, drop local commits)\n"
|
||||
printf "groot\t\tDisplay repository root path (or cd to it with -g)\n"
|
||||
printf "gsync\t\tFetch and rebase current branch onto upstream\n"
|
||||
printf "gst\t\tDisplay short git status and branch tracking info\n"
|
||||
printf "gwip\t\tCreate a quick WIP checkpoint commit\n"
|
||||
printf "gpid\t\tGive the list of PIDs matching the given process name(s)\n"
|
||||
printf "hack\t\tSimulate a dramatic hacking sequence — look dangerous\n"
|
||||
printf "help\t\tDisplay this list, or the usage of a profile command (help <command>)\n"
|
||||
printf "isipv4\t\tTell if the given parameter is a valid IPv4 address\n"
|
||||
printf "isipv6\t\tTell if the given parameter is a valid IPv6 address\n"
|
||||
printf "kt\t\tKill a process and all its children (kill tree)\n"
|
||||
printf "ku\t\tKill all processes owned by the given user name or ID\n"
|
||||
printf "matrix\t\tConsole screensaver with Matrix-style digital rain (binary, kana, ascii charset)\n"
|
||||
printf "mcd\t\tCreate a directory and immediately move into it\n"
|
||||
printf "mdcat\t\tRender Markdown files in terminal with colors and code frames\n"
|
||||
printf "mdcat\t\tRender Markdown files in terminal with colors, tables and code frames\n"
|
||||
printf "meteo\t\tDisplay weather forecast for the configured or given city\n"
|
||||
printf "myextip\t\tGet information about your public IP address\n"
|
||||
printf "pinfo\t\tDisplay system information read from /proc and /sys only\n"
|
||||
printf "pkgf\t\tFind which installed package owns a given file (distro-aware)\n"
|
||||
printf "pkgs\t\tSearch for a pattern in installed package names (distro-aware)\n"
|
||||
printf "ppg\t\tLook for the given pattern in running processes\n"
|
||||
@@ -100,15 +115,15 @@ help()
|
||||
printf "setlocale\tSet console locale to any installed locale\n"
|
||||
printf " * setc\tSet locale to standard C (POSIX)\n"
|
||||
printf " * set*\tLocale shortcuts generated from SET_LOCALE in profile.conf\n"
|
||||
printf "settrace\tActivate or deactivate ERR trap to display backtrace on script errors\n"
|
||||
printf "set_theme\tSwitch the prompt colour theme; no argument lists available themes\n"
|
||||
printf "settrace\tActivate or deactivate ERR trap to display backtrace on script errors\n"
|
||||
printf "showinfo\tDisplay welcome banner and system information (figlet + neofetch/fastfetch)\n"
|
||||
printf "ssr\t\tSSH into a server as root, forwarding extra ssh options\n"
|
||||
printf "taz\t\tCompress files and directories into a chosen archive format\n"
|
||||
printf "term_set\tSet TERM to the best available terminal capability (auto-detect or honour config)\n"
|
||||
printf "urlencode\tURL-encode a string\n"
|
||||
printf "utaz\t\tSmartly uncompress archives (zip, tar.gz/bz2/xz/lz, rar, arj, lha, ace, 7z, zst, cpio, cab, deb, rpm)\n"
|
||||
printf "ver\t\tDisplay the installed profile version\n\n"
|
||||
printf "ver\t\tDisplay the installed profile version\n"
|
||||
|
||||
printf "\nPlease use <command> --help or help <command> to obtain usage details.\n"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user