help bug fix
This commit is contained in:
@@ -115,9 +115,10 @@ A bar-style prompt showing current time, execution time of the last command
|
||||
| `gst` | git | Display compact git status with branch tracking information |
|
||||
| `gwip` | git | Create a quick WIP checkpoint commit |
|
||||
| `hack` | fun | Simulate a dramatic multi-phase hacking sequence |
|
||||
| `help` | help | Display the list of available functions and basic usage; `help <command>` delegates to `<command> --help` |
|
||||
| `help` | help | Display the list of available functions and basic usage; `help <command>` delegates to `<command> --help` for shell functions (profile commands) only; honours `NO_COLOR` |
|
||||
| `isipv4` | net | Tell if the given parameter is a valid IPv4 address |
|
||||
| `isipv6` | net | Tell if the given parameter is a valid IPv6 address |
|
||||
| `kt` | processes | Kill a process and all its children (kill tree); `-n`/`--dry-run`, `-s`/`--signal` |
|
||||
| `ku` | processes | Kill all processes owned by the given user name or ID |
|
||||
| `matrix` | rain | Console screensaver with Matrix-style digital rain (binary, kana, ascii charset) |
|
||||
| `mcd` | filefct | Create a directory and immediately move into it |
|
||||
@@ -125,6 +126,7 @@ A bar-style prompt showing current time, execution time of the last command
|
||||
| `meteo` | info | Display weather forecast for the configured or given city |
|
||||
| `myextip` | net | Get information about your public IP address |
|
||||
| `get_pkgmgr` | packages | Detect the active package manager of the running distribution (`apt`, `dnf`, `yum`, `zypper`, `pacman`, `apk`, `portage`, `xbps`, `nix`) |
|
||||
| `pinfo` | info | Display system information read from `/proc` and `/sys` only |
|
||||
| `pkgf` | packages | Find which installed package owns a given file (distro-aware via `get_pkgmgr`) |
|
||||
| `pkgs` | packages | Search for a pattern in installed package names (distro-aware via `get_pkgmgr`) |
|
||||
| `ppg` | processes | Look for the given pattern in running processes |
|
||||
@@ -138,6 +140,7 @@ A bar-style prompt showing current time, execution time of the last command
|
||||
| `rmspc` | filefct | Replace spaces in filenames with underscores (or a custom character, attached: `-c-` / `--subst-char=-`); never overwrites an existing file and does not follow symlinked directories |
|
||||
| `setc` | lang | Set locale to standard C (POSIX) |
|
||||
| `setlocale` | lang | Set console locale to any installed locale |
|
||||
| `set_theme` | prompt | Switch the prompt colour theme for the session (`--list`, `--preview`, `--save`) |
|
||||
| `settrace` | debug | Activate (`--on`), deactivate (`--off`) or query (`--status`) an ERR trap that prints the exit status and a call stack (on stderr) for each failing command; `--force` replaces/removes an ERR trap set by something else; active at startup when `SETTRACE_DEFAULT_ENABLED=1` |
|
||||
| `showinfo` | info | Display welcome banner and system information (figlet + neofetch/fastfetch) |
|
||||
| `ssr` | ssh | SSH into a server as root, forwarding extra ssh options |
|
||||
|
||||
@@ -80,6 +80,9 @@ Versions follow `MAJOR.MINOR.PATCH-REVISION_STAGE_N` (e.g. `3.99.1-4_rc_1`).
|
||||
a different remote than the one it rebased on; `gacp`/`gsync` handle remote
|
||||
and branch names containing slashes, and refuse a detached HEAD; `ggraph`
|
||||
rejects a limit of 0; internal helpers are exported with the commands.
|
||||
- `help`: `help <command>` no longer runs arbitrary external programs with
|
||||
`--help` (profile functions only); `NO_COLOR` is honoured; `kt`, `pinfo` and
|
||||
`help` itself are listed, and the list is in alphabetical order again.
|
||||
- `compress.sh`: option flags and loop variables no longer leak into the
|
||||
interactive shell.
|
||||
|
||||
|
||||
+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