release 4.2.0
This commit is contained in:
@@ -99,6 +99,7 @@ A bar-style prompt showing current time, execution time of the last command
|
||||
|
||||
| Function | Module | Description |
|
||||
| --- | --- | --- |
|
||||
| `backtrace` | debug | Print the current call stack (function, file, line of each call), innermost frame first; used by the `settrace` error trace |
|
||||
| `busy` | fun | Monitor /dev/urandom for a hex pattern — look busy; the pattern can also be given as argument; runs until a key (or Ctrl-C) is pressed, needs a terminal |
|
||||
| `check_updates` | updates | Check whether a newer profile version is available online; when called with `-q` at startup a 3-second network timeout is applied so a slow or absent network never delays the prompt; the published version is validated before use and an installed version more recent than the published one is not reported as outdated |
|
||||
| `clean` | filefct | Erase backup files in given directories, optionally recursive |
|
||||
@@ -106,6 +107,7 @@ A bar-style prompt showing current time, execution time of the last command
|
||||
| `conf_save` | conf | Save or update a key=value pair in a configuration section: `conf_save <section> <key> <value>`; replaces an existing key in place or appends it to the section (creating the section if absent); works through a symlinked file and keeps its permissions; the value must be single-line and the running shell is not updated (applies at next load) |
|
||||
| `disp` | disp | Display formatted info / warning / error / debug messages; long messages are word-wrapped and continuation lines are indented to align with the message text; honours `NO_COLOR`, `QUIET=1` (hides info messages) and `DEBUG` > 1 (shows debug messages); warnings, errors and debug go to stderr |
|
||||
| `dwl` | net | Download a URL using curl, wget, or fetch transparently; supports `-t <seconds>` / `--timeout <seconds>` to cap the transfer time |
|
||||
| `error` | debug | ERR trap handler installed by `settrace`: reports the failed command status and a call stack on stderr, then keeps the status |
|
||||
| `expandlist` | filefct | Expand glob expressions into a quoted, separated list; names with spaces are kept whole, `\`, `"`, `$` and `` ` `` are escaped, and the separator (`-s`, `-n` or `EXPANDLIST_DEFAULT_SEPARATOR`) may use escapes such as `\n` |
|
||||
| `fake_compile` | fun | Simulate a long compilation process with random warnings and errors |
|
||||
| `file_stats` | filefct | Display file size statistics for a path; `--min`/`--max` are inclusive and validated, the histogram is sorted |
|
||||
@@ -131,6 +133,7 @@ A bar-style prompt showing current time, execution time of the last command
|
||||
| `matrix` | rain | Console screensaver with Matrix-style digital rain (binary, kana, ascii charset) |
|
||||
| `mcd` | filefct | Create a directory and immediately move into it |
|
||||
| `mdcat` | disp | Render Markdown files (or stdin) in terminal with colors, inline formatting, tables and framed code blocks; honours `NO_COLOR` |
|
||||
| `locale_check` | lang | Tell whether a locale is installed, tolerating codeset spellings (`UTF-8`/`utf8`); prints the name exactly as the system spells it |
|
||||
| `meteo` | info | Display weather forecast for the configured or given city |
|
||||
| `myextip` | net | Get information about your public IP address (IP, ISP, location, coordinates, AS, timezone) from an HTTPS lookup service; needs `jq` for the formatted output, `-R` shows the raw JSON |
|
||||
| `get_pkgmgr` | packages | Detect the active package manager of the running distribution (`apt`, `dnf`, `yum`, `zypper`, `pacman`, `apk`, `portage`, `xbps`, `nix`) |
|
||||
@@ -150,6 +153,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 (codeset spelling tolerant, UTF-8 preferred when none is given); clears `LC_ALL` and the other per-category variables so the change always applies |
|
||||
| `set_colors` | disp | (Re)define the colour variables (`Red`, `BIWhite`, `On_Blue`, `RESETCOL`, ...) used by `disp`, the prompt and themes; run at load time |
|
||||
| `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 + fastfetch/neofetch) |
|
||||
|
||||
Executable → Regular
+10
@@ -9,8 +9,15 @@ Versions follow `MAJOR.MINOR.PATCH-REVISION_STAGE_N` (e.g. `3.99.1-4_rc_1`).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
---
|
||||
|
||||
## [4.2.0] — 2026-10-13
|
||||
|
||||
### Added
|
||||
|
||||
- `backtrace`, `locale_check` and `get_pkgmgr` answer `-h` / `--help`, and are
|
||||
listed (with `error` and `set_colors`) in the README functions table and in
|
||||
`help`.
|
||||
- `pkgi` (install) and `pkgr` (uninstall, with `-p`/`--purge` and `-d`/`--deps`)
|
||||
commands for apt, dnf/yum, zypper, pacman, apk, portage, xbps and nix; both
|
||||
accept `-y`/`--yes` and `-n`/`--dry-run` and use `sudo` (or `doas`) when needed.
|
||||
@@ -32,6 +39,9 @@ Versions follow `MAJOR.MINOR.PATCH-REVISION_STAGE_N` (e.g. `3.99.1-4_rc_1`).
|
||||
|
||||
### Fixed
|
||||
|
||||
- `locale_check` without argument failed under `set -u`.
|
||||
- Copyright years: `processes.sh` (2013-2022) updated, the license block added
|
||||
to the two bash-completion scripts.
|
||||
- `taz`: a plain file with the `tar` format could be deleted instead of being
|
||||
archived; existing `<item>.tar` files are no longer overwritten; trailing
|
||||
slashes, `.`/`..` and names starting with `-` are handled; the `gzip`
|
||||
|
||||
Executable → Regular
+4
-1
@@ -108,7 +108,10 @@ brew install shellcheck
|
||||
environment. Prefer upper case for global and lowercase for local.
|
||||
- **`printf`** instead of `echo` all the time.
|
||||
- **Never `eval`** — use namerefs (`local -n`), `${!varname}` indirection, or
|
||||
`declare -g` instead.
|
||||
`declare -g` instead. The only exception is the function generator of
|
||||
`build_locale_shortcuts` (`profile.d/lang.sh`): bash cannot create a function
|
||||
whose name is only known at run time otherwise, and the only value injected
|
||||
into it is quoted with `printf %q`.
|
||||
- **No hardcoded defaults** — wire every configurable value through
|
||||
`${VAR:-default}` and document the key in `profile.conf` and `README.md §4`.
|
||||
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
@@ -1,5 +1,38 @@
|
||||
#!/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.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Git helper completions for profile.d/git.sh shortcuts.
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Executable → Regular
+33
@@ -1,5 +1,38 @@
|
||||
#!/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.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Prompt helper completions for profile.d/prompt.sh shortcuts.
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -43,8 +43,14 @@ load_conf "debug"
|
||||
# Display a backtrace of the current call stack (innermost frame first), one
|
||||
# line per frame: function, file where it is defined, line of the call site.
|
||||
# Usage: backtrace
|
||||
# shellcheck disable=SC2120 # only --help is a possible argument
|
||||
backtrace()
|
||||
{
|
||||
if [[ "${1:-}" == -h || "${1:-}" == --help ]]; then
|
||||
printf "backtrace: print the current call stack, innermost frame first.\n"
|
||||
printf "Usage: backtrace\n"
|
||||
return 0
|
||||
fi
|
||||
printf "========= Call stack =========\n"
|
||||
local i=1 # We begin at 1 to ignore backtrace itself
|
||||
while [[ $i -lt ${#FUNCNAME[@]} ]]; do
|
||||
|
||||
@@ -34,6 +34,12 @@
|
||||
# * OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
load_conf "help"
|
||||
|
||||
# Common helpers, then the ones private to this module (helpers/help.sh)
|
||||
declare -F _profile_load_helpers >/dev/null || . "$(dirname -- "${BASH_SOURCE[0]}")/../helpers/common.sh"
|
||||
_profile_load_helpers "${BASH_SOURCE[0]}"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Display list of commands and general informations
|
||||
# Usage: help [command]
|
||||
@@ -66,6 +72,7 @@ help()
|
||||
printf "%b%s%b\n\n" "$BIWhite" \
|
||||
"Welcome to your profile! Here is a list of available commands:" "$DEFAULTCOL"
|
||||
fi
|
||||
printf "backtrace\tPrint the current call stack\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"
|
||||
@@ -81,6 +88,7 @@ help()
|
||||
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 "get_pkgmgr\tDetect the package manager of the running distribution\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"
|
||||
@@ -95,6 +103,7 @@ help()
|
||||
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 "locale_check\tTell whether a locale is installed (canonical name on stdout)\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, tables and code frames\n"
|
||||
|
||||
+7
-1
@@ -48,7 +48,13 @@ load_conf lang
|
||||
# Usage: canonical=$(locale_check <locale>) || handle-missing
|
||||
locale_check()
|
||||
{
|
||||
local requested="$1"
|
||||
if [[ "${1:-}" == -h || "${1:-}" == --help ]]; then
|
||||
printf "locale_check: tell whether a locale is installed.\n"
|
||||
printf "Usage: locale_check <locale>\n"
|
||||
printf "Prints the name of the locale as the system spells it; status 1 if it is not installed.\n"
|
||||
return 0
|
||||
fi
|
||||
local requested="${1:-}"
|
||||
[[ -z $requested ]] && { disp W "No locale given to check."; return 1; }
|
||||
|
||||
# Split "lang_TERRITORY[.codeset][@modifier]" into base, codeset, modifier.
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
|
||||
load_conf "net"
|
||||
|
||||
# Common helpers, then the ones private to this module (helpers/packages.sh)
|
||||
# Common helpers, then the ones private to this module (helpers/net.sh)
|
||||
declare -F _profile_load_helpers >/dev/null || . "$(dirname -- "${BASH_SOURCE[0]}")/../helpers/common.sh"
|
||||
_profile_load_helpers "${BASH_SOURCE[0]}"
|
||||
|
||||
|
||||
@@ -46,8 +46,15 @@ _profile_load_helpers "${BASH_SOURCE[0]}"
|
||||
# checking available binaries in a fixed priority order.
|
||||
# Echoes one of: apt dnf yum zypper pacman apk portage xbps nix
|
||||
# Returns 1 if no known package manager could be identified.
|
||||
# shellcheck disable=SC2120 # only --help is a possible argument
|
||||
get_pkgmgr()
|
||||
{
|
||||
if [[ "${1:-}" == -h || "${1:-}" == --help ]]; then
|
||||
printf "get_pkgmgr: print the package manager of the running distribution.\n"
|
||||
printf "Usage: get_pkgmgr\n"
|
||||
printf "Prints one of: apt dnf yum zypper pacman apk portage xbps nix (status 1 if unknown).\n"
|
||||
return 0
|
||||
fi
|
||||
local distro_id="" distro_like=""
|
||||
if [[ -r /etc/os-release ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2013-2022 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
|
||||
# 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,
|
||||
|
||||
Reference in New Issue
Block a user