make defaults configurable
This commit is contained in:
174
profile.conf
174
profile.conf
@@ -12,26 +12,71 @@ PAGER=less
|
|||||||
TERM=xterm-256color
|
TERM=xterm-256color
|
||||||
|
|
||||||
[compress]
|
[compress]
|
||||||
# Section used by compress.sh
|
# Section used by compress.sh (taz and utaz functions).
|
||||||
|
|
||||||
|
# taz: Default archive format when -f/--format is not specified.
|
||||||
|
# Supported values: lz (default), xz, bz2, gz, lzo, tar
|
||||||
|
#TAZ_DEFAULT_FORMAT=lz
|
||||||
|
|
||||||
|
# taz: Default number of compression threads when -p/--parallel is not specified.
|
||||||
|
# Set to the number of CPU cores to use parallel compression where supported.
|
||||||
|
#TAZ_DEFAULT_THREADS=1
|
||||||
|
|
||||||
|
# taz: Default compression level when none is given (1=fast/big .. 9=slow/small).
|
||||||
|
#TAZ_DEFAULT_LEVEL=6
|
||||||
|
|
||||||
|
# utaz: Delete source archives after successful extraction (0=no, 1=yes).
|
||||||
|
#UTAZ_DEFAULT_DELETE=0
|
||||||
|
|
||||||
|
# utaz: Default directory creation mode when neither --create-dir nor --no-dir is given.
|
||||||
|
# Supported values:
|
||||||
|
# auto (default) — create a subdirectory only when the archive contains
|
||||||
|
# multiple top-level entries or a bare file
|
||||||
|
# always — always extract into a new subdirectory
|
||||||
|
# never — always flatten extraction into the current directory
|
||||||
|
#UTAZ_DEFAULT_DIR_MODE=auto
|
||||||
|
|
||||||
[debug]
|
[debug]
|
||||||
# Section used by debug.sh
|
# Section used by debug.sh (nothing yet)
|
||||||
|
|
||||||
[disp]
|
[disp]
|
||||||
# Section used by disp.sh
|
# Section used by disp.sh
|
||||||
|
|
||||||
# Set to any value to disable colors in internal profile output (not controling binary output)
|
# Set to any value to disable colors in internal profile output (not controling binary output)
|
||||||
# NO_COLOR=1
|
# NO_COLOR=1
|
||||||
|
|
||||||
[filefct]
|
[filefct]
|
||||||
# Section used by filefct.sh
|
# Section used by filefct.sh
|
||||||
|
|
||||||
|
# expandlist: Default output separator between items (default: space).
|
||||||
|
# Use \n for newline, or any other character/string.
|
||||||
|
#EXPANDLIST_DEFAULT_SEPARATOR=" "
|
||||||
|
|
||||||
|
# clean: Enable recursive mode by default (0=no, 1=yes).
|
||||||
|
#CLEAN_DEFAULT_RECURSIVE=0
|
||||||
|
|
||||||
|
# rmspc: Default character used to replace spaces in filenames (default: underscore).
|
||||||
|
# Set to empty to concatenate words without separator (equivalent to --subst-char with no value).
|
||||||
|
#RMSPC_DEFAULT_CHAR=_
|
||||||
|
|
||||||
|
# findbig: Default number of results to return (default: 10).
|
||||||
|
#FINDBIG_DEFAULT_LIMIT=10
|
||||||
|
|
||||||
[fun]
|
[fun]
|
||||||
# Section used by fun.sh
|
# Section used by fun.sh (busy function).
|
||||||
|
|
||||||
|
# busy: Default hex pattern to search for in /dev/urandom hexdump (default: "ca fe").
|
||||||
|
#BUSY_DEFAULT_PATTERN=ca fe
|
||||||
|
|
||||||
|
# busy: Default delay between matched lines in milliseconds (default: 0 = no delay).
|
||||||
|
#BUSY_DEFAULT_DELAY=0
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
# Section used by info.sh
|
# Section used by info.sh
|
||||||
# Default city for weather forcast and local news
|
|
||||||
DEFAULT_CITY="Toulouse"
|
# meteo: Default city used when no city argument is given.
|
||||||
|
# Unset or empty disables the fallback and requires an explicit city argument.
|
||||||
|
METEO_DEFAULT_CITY="Toulouse"
|
||||||
|
|
||||||
[lang]
|
[lang]
|
||||||
# Section used by lang.sh
|
# Section used by lang.sh
|
||||||
@@ -40,23 +85,136 @@ DEFAULT_CITY="Toulouse"
|
|||||||
SET_LOCALE="fr:fr_FR.UTF-8,us:en_US.UTF-8"
|
SET_LOCALE="fr:fr_FR.UTF-8,us:en_US.UTF-8"
|
||||||
|
|
||||||
[net]
|
[net]
|
||||||
# Section used by net.sh
|
# Section used by net.sh (dwl, myextip functions).
|
||||||
|
|
||||||
|
# dwl: Force a specific download tool instead of auto-detecting (curl → wget → fetch).
|
||||||
|
# Supported values: curl, wget, fetch. Unset uses auto-detection (default).
|
||||||
|
#DWL_PREFERRED_TOOL=curl
|
||||||
|
|
||||||
|
# myextip: API endpoint URL used to retrieve external IP information.
|
||||||
|
# Default: https://ip-api.com/json/
|
||||||
|
# Compatible alternatives: https://ipinfo.io/json, https://ip-api.com/json/
|
||||||
|
#MYEXTIP_DEFAULT_URL=https://ip-api.com/json/
|
||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
# Section used by packages.sh
|
# Section used by packages.sh
|
||||||
|
|
||||||
|
# pkgs: Enable case-insensitive search by default (1=yes, 0=no; default: 0).
|
||||||
|
#PKGS_DEFAULT_IGNORE_CASE=0
|
||||||
|
|
||||||
|
[processes]
|
||||||
|
# Section used by processes.sh
|
||||||
|
|
||||||
|
# ppu: Output columns passed to ps -o when listing processes for a user.
|
||||||
|
# Comma-separated list of ps field names. Default: pid,user,%cpu,%mem,start,time,command
|
||||||
|
#PPU_DEFAULT_FORMAT=pid,user,%cpu,%mem,start,time,command
|
||||||
|
|
||||||
|
# ku: Signal sent to processes when killing a user's session (default: TERM).
|
||||||
|
# Use signal names without the SIG prefix (e.g. TERM, KILL, HUP).
|
||||||
|
#KU_DEFAULT_SIGNAL=TERM
|
||||||
|
|
||||||
[prompt]
|
[prompt]
|
||||||
# Section used by prompt.sh
|
# Section used by prompt.sh
|
||||||
|
|
||||||
|
# Name of the theme to load, or an explicit path to a .theme file.
|
||||||
|
# Bare names are resolved as $PROMPT_THEME_DIR/<name>.theme.
|
||||||
|
# When unset, no theme is loaded and the hardcoded fallback colours are used.
|
||||||
|
#PROMPT_THEME=default
|
||||||
|
|
||||||
|
# Directory that contains .theme files. Defaults to profile.d/themes/ inside
|
||||||
|
# the profile installation directory.
|
||||||
|
#PROMPT_THEME_DIR=/path/to/themes
|
||||||
|
|
||||||
|
# Individual colour overrides. These always win over the loaded theme.
|
||||||
|
# Values must be valid ANSI escape sequences as exported by disp.sh, e.g.:
|
||||||
|
# \e[0;34m (Blue) \e[42m (On_Green) \e[1;32m (BGreen)
|
||||||
|
# All keys listed below correspond to variables exported by disp.sh.
|
||||||
|
|
||||||
|
# Clock segment
|
||||||
|
#PROMPT_COLOR_TIME_FG=$Blue
|
||||||
|
#PROMPT_COLOR_TIME_BG=$On_IBlack
|
||||||
|
|
||||||
|
# Main bar background (success and info)
|
||||||
|
#PROMPT_COLOR_BAR_BG=$On_Blue
|
||||||
|
|
||||||
|
# Exit-code segment — success state
|
||||||
|
#PROMPT_COLOR_OK_FG=$White
|
||||||
|
#PROMPT_COLOR_OK_MARK=$Green
|
||||||
|
|
||||||
|
# Exit-code segment — failure state
|
||||||
|
#PROMPT_COLOR_ERR_BG=$On_Red
|
||||||
|
#PROMPT_COLOR_ERR_FG=$White
|
||||||
|
#PROMPT_COLOR_ERR_MARK=$BYellow
|
||||||
|
|
||||||
|
# User/host colours
|
||||||
|
#PROMPT_COLOR_ROOT_FG=$Red
|
||||||
|
#PROMPT_COLOR_USER_FG=$Green
|
||||||
|
|
||||||
|
# Working directory
|
||||||
|
#PROMPT_COLOR_DIR_FG=$ICyan
|
||||||
|
|
||||||
[pwd]
|
[pwd]
|
||||||
# Section used by pwd.sh
|
# Section used by pwd.sh (genpwd and pwdscore functions).
|
||||||
|
|
||||||
|
# genpwd: Default password length (default: 16).
|
||||||
|
#GENPWD_DEFAULT_LENGTH=16
|
||||||
|
|
||||||
|
# genpwd: Maximum occurrences of any single character (default: 2).
|
||||||
|
#GENPWD_DEFAULT_OCCURS=2
|
||||||
|
|
||||||
|
# genpwd: Number of passwords generated when no count argument is given (default: 1).
|
||||||
|
#GENPWD_DEFAULT_COUNT=1
|
||||||
|
|
||||||
|
# genpwd: Include symbols in the character pool (1=yes, 0=no; default: 1).
|
||||||
|
#GENPWD_DEFAULT_SYMBOLS=1
|
||||||
|
|
||||||
|
# genpwd: Include uppercase letters in the character pool (1=yes, 0=no; default: 1).
|
||||||
|
#GENPWD_DEFAULT_UPPERCASE=1
|
||||||
|
|
||||||
|
# genpwd: Include lowercase letters in the character pool (1=yes, 0=no; default: 1).
|
||||||
|
#GENPWD_DEFAULT_LOWERCASE=1
|
||||||
|
|
||||||
|
# genpwd: Include digits in the character pool (1=yes, 0=no; default: 1).
|
||||||
|
#GENPWD_DEFAULT_NUMBERS=1
|
||||||
|
|
||||||
|
# pwdscore: Show verbose breakdown by default (1=yes, 0=no; default: 0).
|
||||||
|
#PWDSCORE_DEFAULT_VERBOSE=0
|
||||||
|
|
||||||
[rain]
|
[rain]
|
||||||
# Section used by rain.sh
|
# Section used by rain.sh (rain and matrix functions).
|
||||||
|
|
||||||
|
# rain: Default speed value, using the /100 scale (5 => 0.050s, 10 => 0.100s).
|
||||||
|
# Values < 1 are interpreted as raw seconds.
|
||||||
|
#RAIN_DEFAULT_SPEED=5
|
||||||
|
|
||||||
|
# rain: Default color theme.
|
||||||
|
# Supported values: white (default), green, blue, red, yellow, cyan
|
||||||
|
#RAIN_DEFAULT_COLOR=white
|
||||||
|
|
||||||
|
# matrix: Default speed value, using the /100 scale (3.5 => 0.035s).
|
||||||
|
#MATRIX_DEFAULT_SPEED=3.5
|
||||||
|
|
||||||
|
# matrix: Default color theme.
|
||||||
|
# Supported values: green (default), blue, red, yellow, cyan, white
|
||||||
|
#MATRIX_DEFAULT_COLOR=green
|
||||||
|
|
||||||
|
# matrix: Default character set.
|
||||||
|
# Supported values: binary (default), kana, ascii
|
||||||
|
MATRIX_DEFAULT_CHARSET=kana
|
||||||
|
|
||||||
[ssh]
|
[ssh]
|
||||||
# Section used by ssh.sh
|
# Section used by ssh.sh
|
||||||
|
|
||||||
|
# ssr: Default SSH options prepended to every ssr invocation.
|
||||||
|
# Options are word-split, so space-separated flags are supported.
|
||||||
|
# The default behaviour without this key is equivalent to: SSH_DEFAULT_OPT=-Y
|
||||||
|
# Set to an empty value to pass no default options.
|
||||||
|
# Examples:
|
||||||
|
# SSH_DEFAULT_OPT=-Y # X11 forwarding (original default)
|
||||||
|
# SSH_DEFAULT_OPT=-Y -o StrictHostKeyChecking=accept-new
|
||||||
|
# SSH_DEFAULT_OPT= # no default options
|
||||||
|
#SSH_DEFAULT_OPT=-Y
|
||||||
|
|
||||||
[updates]
|
[updates]
|
||||||
# Section used by updates.sh
|
# Section used by updates.sh
|
||||||
|
|
||||||
|
|||||||
@@ -204,6 +204,15 @@ utaz()
|
|||||||
local FILES=("$@")
|
local FILES=("$@")
|
||||||
[[ ${#FILES[@]} -eq 0 ]] && FILES=(".")
|
[[ ${#FILES[@]} -eq 0 ]] && FILES=(".")
|
||||||
|
|
||||||
|
# Apply defaults from [compress] configuration if not overridden by flags
|
||||||
|
[[ -z ${willrm+x} ]] && [[ ${UTAZ_DEFAULT_DELETE:-0} -eq 1 ]] && willrm=1
|
||||||
|
if [[ -z ${createdir+x} && -z ${nodir+x} ]]; then
|
||||||
|
case "${UTAZ_DEFAULT_DIR_MODE:-auto}" in
|
||||||
|
always) createdir=1 ;;
|
||||||
|
never) nodir=1 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
[[ -n ${createdir} && -n ${nodir} ]] && \
|
[[ -n ${createdir} && -n ${nodir} ]] && \
|
||||||
disp E "The --create-dir and --no-dir options are mutually exclusive."
|
disp E "The --create-dir and --no-dir options are mutually exclusive."
|
||||||
|
|
||||||
@@ -565,9 +574,9 @@ taz()
|
|||||||
local FILES=("$@")
|
local FILES=("$@")
|
||||||
[[ ${#FILES[@]} -eq 0 ]] && FILES=(".")
|
[[ ${#FILES[@]} -eq 0 ]] && FILES=(".")
|
||||||
|
|
||||||
[[ ! $compform ]] && compform=lz # safe and efficient (unless data are already compressed)
|
[[ ! $compform ]] && compform=${TAZ_DEFAULT_FORMAT:-lz}
|
||||||
[[ ! $nproc ]] && nproc=1
|
[[ ! $nproc ]] && nproc=${TAZ_DEFAULT_THREADS:-1}
|
||||||
[[ ! $complevel ]] && complevel=6
|
[[ ! $complevel ]] && complevel=${TAZ_DEFAULT_LEVEL:-6}
|
||||||
[[ $verbose -gt 1 && $quiet -gt 1 ]] &&
|
[[ $verbose -gt 1 && $quiet -gt 1 ]] &&
|
||||||
disp E "The --verbose and --quiet options can't be used together."
|
disp E "The --verbose and --quiet options can't be used together."
|
||||||
|
|
||||||
@@ -619,4 +628,6 @@ export -f taz
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
load_conf "compress"
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
# Usage: expandlist [options] <item1 [item2 ... itemN]>
|
# Usage: expandlist [options] <item1 [item2 ... itemN]>
|
||||||
expandlist()
|
expandlist()
|
||||||
{
|
{
|
||||||
local separator=" "
|
local separator="${EXPANDLIST_DEFAULT_SEPARATOR:- }"
|
||||||
local PARSED
|
local PARSED
|
||||||
|
|
||||||
PARSED=$(getopt -o hs:n --long help,separator:,newline -n 'expandlist' -- "$@")
|
PARSED=$(getopt -o hs:n --long help,separator:,newline -n 'expandlist' -- "$@")
|
||||||
@@ -122,7 +122,7 @@ export -f expandlist
|
|||||||
# -s, --shell: do nothing and display what will be executed
|
# -s, --shell: do nothing and display what will be executed
|
||||||
clean()
|
clean()
|
||||||
{
|
{
|
||||||
local recursive=0 force=0 outshell=0
|
local recursive=${CLEAN_DEFAULT_RECURSIVE:-0} force=0 outshell=0
|
||||||
|
|
||||||
# Define short and long options
|
# Define short and long options
|
||||||
local PARSED
|
local PARSED
|
||||||
@@ -236,7 +236,7 @@ export -f mcd
|
|||||||
rmspc()
|
rmspc()
|
||||||
{
|
{
|
||||||
local recurs=0 verb=0 shell=0
|
local recurs=0 verb=0 shell=0
|
||||||
local substchar="_" substchar_set=0
|
local substchar="${RMSPC_DEFAULT_CHAR:-_}" substchar_set=0
|
||||||
local mvopt=()
|
local mvopt=()
|
||||||
local PARSED
|
local PARSED
|
||||||
|
|
||||||
@@ -574,7 +574,7 @@ export -f file_stats
|
|||||||
# -l : limit : number of files to return (default is 10)
|
# -l : limit : number of files to return (default is 10)
|
||||||
findbig()
|
findbig()
|
||||||
{
|
{
|
||||||
local details=0 limit=10 one_fs=0
|
local details=0 limit=${FINDBIG_DEFAULT_LIMIT:-10} one_fs=0
|
||||||
|
|
||||||
local PARSED
|
local PARSED
|
||||||
PARSED=$(getopt -o hdl:x --long help,details,limit:,one-fs -n 'findbig' -- "$@")
|
PARSED=$(getopt -o hdl:x --long help,details,limit:,one-fs -n 'findbig' -- "$@")
|
||||||
@@ -792,4 +792,6 @@ export -f finddead
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
load_conf "filefct"
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
# pattern : the string to search for in the hexdump output (default is "ca fe")
|
# pattern : the string to search for in the hexdump output (default is "ca fe")
|
||||||
busy()
|
busy()
|
||||||
{
|
{
|
||||||
local pattern="ca fe" delay_ms=0
|
local pattern="${BUSY_DEFAULT_PATTERN:-ca fe}" delay_ms="${BUSY_DEFAULT_DELAY:-0}"
|
||||||
|
|
||||||
local PARSED
|
local PARSED
|
||||||
# Short: h, p:, d:
|
# Short: h, p:, d:
|
||||||
@@ -109,4 +109,6 @@ busy()
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
load_conf "fun"
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
@@ -108,7 +108,12 @@ meteo()
|
|||||||
|
|
||||||
local cities=("$@")
|
local cities=("$@")
|
||||||
local city="" encoded=""
|
local city="" encoded=""
|
||||||
[[ $# -eq 0 ]] && cities=("$DEFAULT_CITY")
|
[[ $# -eq 0 ]] && cities=("${METEO_DEFAULT_CITY:-}")
|
||||||
|
|
||||||
|
if [[ ${#cities[@]} -eq 0 || -z "${cities[0]}" ]]; then
|
||||||
|
disp E "No city given and METEO_DEFAULT_CITY is not set. Use 'meteo <city>'."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
for city in "${cities[@]}"; do
|
for city in "${cities[@]}"; do
|
||||||
encoded=$(urlencode "$city")
|
encoded=$(urlencode "$city")
|
||||||
|
|||||||
@@ -67,16 +67,38 @@ dwl()
|
|||||||
local url="$1"
|
local url="$1"
|
||||||
local output="$2"
|
local output="$2"
|
||||||
|
|
||||||
if command -v curl >/dev/null 2>&1; then
|
# Honour preferred tool from configuration; fall back to auto-detection.
|
||||||
[ -z "$output" ] && curl -sL "$url" || curl -sL -o "$output" "$url"
|
local preferred="${DWL_PREFERRED_TOOL:-}"
|
||||||
|
|
||||||
|
_try_curl() { [ -z "$output" ] && curl -sL "$url" || curl -sL -o "$output" "$url"; }
|
||||||
|
_try_wget() { [ -z "$output" ] && wget -qO- "$url" || wget -q -O "$output" "$url"; }
|
||||||
|
_try_fetch() { [ -z "$output" ] && fetch -o - "$url" || fetch -o "$output" "$url"; }
|
||||||
|
|
||||||
|
if [[ -n "$preferred" ]]; then
|
||||||
|
command -v "$preferred" >/dev/null 2>&1 || {
|
||||||
|
echo "Error: preferred download tool '$preferred' is not installed." >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
case "$preferred" in
|
||||||
|
curl) _try_curl ;;
|
||||||
|
wget) _try_wget ;;
|
||||||
|
fetch) _try_fetch ;;
|
||||||
|
*)
|
||||||
|
echo "Error: DWL_PREFERRED_TOOL '$preferred' is not supported (use curl, wget or fetch)." >&2
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
elif command -v curl >/dev/null 2>&1; then
|
||||||
|
_try_curl
|
||||||
elif command -v wget >/dev/null 2>&1; then
|
elif command -v wget >/dev/null 2>&1; then
|
||||||
[ -z "$output" ] && wget -qO- "$url" || wget -q -O "$output" "$url"
|
_try_wget
|
||||||
elif command -v fetch >/dev/null 2>&1; then
|
elif command -v fetch >/dev/null 2>&1; then
|
||||||
[ -z "$output" ] && fetch -o - "$url" || fetch -o "$output" "$url"
|
_try_fetch
|
||||||
else
|
else
|
||||||
echo "Error: No download utility (curl, wget, or fetch) found." >&2
|
echo "Error: No download utility (curl, wget, or fetch) found." >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
unset -f _try_curl _try_wget _try_fetch
|
||||||
}
|
}
|
||||||
export -f dwl
|
export -f dwl
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
@@ -236,13 +258,12 @@ myextip()
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
# Fetch data. Allow overriding endpoint via env var MYEXTIP_URL
|
# Fetch data. Allow overriding endpoint via MYEXTIP_DEFAULT_URL config key.
|
||||||
local MYEXTIP_URL
|
local api_url="${MYEXTIP_DEFAULT_URL:-https://ip-api.com/json/}"
|
||||||
MYEXTIP_URL=${MYEXTIP_URL:-https://ip-api.com/json/}
|
|
||||||
|
|
||||||
local response
|
local response
|
||||||
if ! response=$(dwl "$MYEXTIP_URL"); then
|
if ! response=$(dwl "$api_url"); then
|
||||||
disp E "Failed to fetch external IP information from $MYEXTIP_URL"
|
disp E "Failed to fetch external IP information from $api_url"
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -272,3 +293,7 @@ export -f myextip
|
|||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# EOF
|
# EOF
|
||||||
|
|
||||||
|
load_conf "net"
|
||||||
|
|
||||||
|
# EOF
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
# Usage: dpkgs <string>
|
# Usage: dpkgs <string>
|
||||||
pkgs()
|
pkgs()
|
||||||
{
|
{
|
||||||
local ignore_case=0
|
local ignore_case=${PKGS_DEFAULT_IGNORE_CASE:-0}
|
||||||
|
|
||||||
local PARSED
|
local PARSED
|
||||||
PARSED=$(getopt -o hi --long help,ignore-case -n 'pkgs' -- "$@")
|
PARSED=$(getopt -o hi --long help,ignore-case -n 'pkgs' -- "$@")
|
||||||
@@ -96,4 +96,6 @@ export -f pkgs
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
load_conf "packages"
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ ppu()
|
|||||||
|
|
||||||
# -u lists processes for a specific user
|
# -u lists processes for a specific user
|
||||||
# -o provides a clean, standard output format
|
# -o provides a clean, standard output format
|
||||||
ps -u "$1" -o pid,user,%cpu,%mem,start,time,command
|
ps -u "$1" -o "${PPU_DEFAULT_FORMAT:-pid,user,%cpu,%mem,start,time,command}"
|
||||||
}
|
}
|
||||||
export -f ppu
|
export -f ppu
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
@@ -206,7 +206,7 @@ ku()
|
|||||||
disp E "User '$u' does not exist."
|
disp E "User '$u' does not exist."
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
killall -u "$u"
|
killall ${KU_DEFAULT_SIGNAL:+-${KU_DEFAULT_SIGNAL}} -u "$u"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -249,5 +249,7 @@ export -f kt
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
load_conf "processes"
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|
||||||
|
|||||||
@@ -52,10 +52,13 @@
|
|||||||
# The function is very slow on Windows
|
# The function is very slow on Windows
|
||||||
genpwd()
|
genpwd()
|
||||||
{
|
{
|
||||||
local length=16
|
local length=${GENPWD_DEFAULT_LENGTH:-16}
|
||||||
local occurs=2
|
local occurs=${GENPWD_DEFAULT_OCCURS:-2}
|
||||||
local symb=1 maj=1 min=1 numb=1
|
local symb=${GENPWD_DEFAULT_SYMBOLS:-1}
|
||||||
local nbpwd=1
|
local maj=${GENPWD_DEFAULT_UPPERCASE:-1}
|
||||||
|
local min=${GENPWD_DEFAULT_LOWERCASE:-1}
|
||||||
|
local numb=${GENPWD_DEFAULT_NUMBERS:-1}
|
||||||
|
local nbpwd=${GENPWD_DEFAULT_COUNT:-1}
|
||||||
local extcar=""
|
local extcar=""
|
||||||
|
|
||||||
local PARSED
|
local PARSED
|
||||||
@@ -272,7 +275,7 @@ export -f genpwd
|
|||||||
# Usage: pwdscore [options] <password>
|
# Usage: pwdscore [options] <password>
|
||||||
pwdscore()
|
pwdscore()
|
||||||
{
|
{
|
||||||
local verbose=0
|
local verbose=${PWDSCORE_DEFAULT_VERBOSE:-0}
|
||||||
local read_stdin=0
|
local read_stdin=0
|
||||||
local password=""
|
local password=""
|
||||||
|
|
||||||
@@ -474,4 +477,6 @@ export -f pwdscore
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
load_conf "pwd"
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
@@ -292,8 +292,10 @@ rain()
|
|||||||
printf "Example: rain --color green --speed 3\n"
|
printf "Example: rain --color green --speed 3\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
local step_duration=0.050
|
local _raw_speed="${RAIN_DEFAULT_SPEED:-5}"
|
||||||
local base_color="white"
|
local step_duration
|
||||||
|
step_duration=$(_rain_normalize_speed "$_raw_speed") || step_duration=0.050
|
||||||
|
local base_color="${RAIN_DEFAULT_COLOR:-white}"
|
||||||
|
|
||||||
while [[ "$#" -gt 0 ]]; do
|
while [[ "$#" -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
@@ -360,9 +362,11 @@ matrix()
|
|||||||
printf "Example: matrix -C kana -c green --speed 2\n"
|
printf "Example: matrix -C kana -c green --speed 2\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
local step_duration=0.035
|
local _raw_speed="${MATRIX_DEFAULT_SPEED:-3.5}"
|
||||||
local base_color="green"
|
local step_duration
|
||||||
local charset="binary"
|
step_duration=$(_rain_normalize_speed "$_raw_speed") || step_duration=0.035
|
||||||
|
local base_color="${MATRIX_DEFAULT_COLOR:-green}"
|
||||||
|
local charset="${MATRIX_DEFAULT_CHARSET:-binary}"
|
||||||
|
|
||||||
while [[ "$#" -gt 0 ]]; do
|
while [[ "$#" -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
@@ -430,4 +434,7 @@ matrix()
|
|||||||
export -f matrix
|
export -f matrix
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
load_conf "rain"
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
@@ -186,10 +186,20 @@ ssr()
|
|||||||
local srv=$1
|
local srv=$1
|
||||||
shift
|
shift
|
||||||
|
|
||||||
ssh -Y root@"$srv" "$@"
|
# Build default options array from config, falling back to -Y (X11 forwarding)
|
||||||
|
local -a ssh_default_opts=()
|
||||||
|
if [[ -n "${SSH_DEFAULT_OPT:-}" ]]; then
|
||||||
|
read -ra ssh_default_opts <<< "${SSH_DEFAULT_OPT}"
|
||||||
|
else
|
||||||
|
ssh_default_opts=(-Y)
|
||||||
|
fi
|
||||||
|
|
||||||
|
ssh "${ssh_default_opts[@]}" root@"$srv" "$@"
|
||||||
}
|
}
|
||||||
export -f ssr
|
export -f ssr
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
load_conf "ssh"
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
Reference in New Issue
Block a user