113 lines
6.3 KiB
Bash
113 lines
6.3 KiB
Bash
#!/usr/bin/env bash
|
|
# ------------------------------------------------------------------------------
|
|
# Copyright (c) 2013-2026 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
|
|
# Protected by the BSD3 license. Please read bellow for details.
|
|
#
|
|
# * Redistribution and use in source and binary forms,
|
|
# * with or without modification, are permitted provided
|
|
# * that the following conditions are met:
|
|
# *
|
|
# * Redistributions of source code must retain the above
|
|
# * copyright notice, this list of conditions and the
|
|
# * following disclaimer.
|
|
# *
|
|
# * Redistributions in binary form must reproduce the above
|
|
# * copyright notice, this list of conditions and the following
|
|
# * disclaimer in the documentation and/or other materials
|
|
# * provided with the distribution.
|
|
# *
|
|
# * Neither the name of the copyright holder nor the names
|
|
# * of any other contributors may be used to endorse or
|
|
# * promote products derived from this software without
|
|
# * specific prior written permission.
|
|
# *
|
|
# * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
# * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
# * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
# * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
# * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
# * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
# * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
# * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
# * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
# * OF SUCH DAMAGE.
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Display list of commands and general informations
|
|
# Usage: help [command]
|
|
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=SC2059 # printf format is a color variable
|
|
printf "${BIWhite}Welcome to your profile! Here is a list of available commands:${DEFAULTCOL}\n\n"
|
|
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"
|
|
printf "disp\t\tDisplay formatted info/warning/error/debug messages\n"
|
|
printf "dwl\t\tDownload a URL using curl, wget, or fetch transparently\n"
|
|
printf "expandlist\tExpand glob expressions into a quoted, separated list\n"
|
|
printf "file_stats\tDisplay file size statistics for a path\n"
|
|
printf "findbig\t\tFind the biggest files in the given or current directory\n"
|
|
printf "finddead\tFind dead symbolic links in the given or current directory\n"
|
|
printf "findzero\tFind empty files in the given or current directory\n"
|
|
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 "gprune\t\tDelete local branches already merged into main branch\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 "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 "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 "meteo\t\tDisplay weather forecast for the configured or given city\n"
|
|
printf "myextip\t\tGet information about your public IP address\n"
|
|
printf "pkgs\t\tSearch for a pattern in installed package names (dpkg/rpm, supports -i)\n"
|
|
printf "ppg\t\tLook for the given pattern in running processes\n"
|
|
printf "ppn\t\tList processes matching an exact command name\n"
|
|
printf "ppu\t\tList processes owned by a specific user\n"
|
|
printf "profile_upgrade\tUpgrade profile to the latest version (git pull or archive)\n"
|
|
printf "pwdscore\tCalculate the strength score of a given password\n"
|
|
printf "rain\t\tConsole screensaver with falling-rain effect (multiple color themes)\n"
|
|
printf "rmhost\t\tRemove host (name and IP) from SSH known_hosts; supports --all-users as root\n"
|
|
printf "rmspc\t\tReplace spaces in filenames with underscores (or a custom character)\n"
|
|
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 "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 "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 "\nPlease use <command> --help or help <command> to obtain usage details.\n"
|
|
}
|
|
export -f help
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# EOF
|