Simplify prettified output
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,6 +2,6 @@
|
||||
.vscode/
|
||||
installJRMC.zip
|
||||
README.shdoc.md
|
||||
README.bbcode
|
||||
.README.bbcode
|
||||
output/
|
||||
*.code-workspace
|
||||
19
installJRMC
19
installJRMC
@@ -15,7 +15,7 @@
|
||||
# shellcheck disable=SC2329
|
||||
shopt -s extglob
|
||||
|
||||
declare -g SCRIPT_VERSION="1.36.3"
|
||||
declare -g SCRIPT_VERSION="1.36.4-dev"
|
||||
declare -g MC_VERSION_HARDCODE="36.0.20" # do find all replace
|
||||
declare -g MC_REPO_HARDCODE="bookworm" # should match the MC_VERSION_HARDCODE
|
||||
declare -gi SELF_UPDATE_SWITCH=1 # 0 to disable installJRMC self-updater
|
||||
@@ -2165,18 +2165,11 @@ main() {
|
||||
|
||||
# @section Helper functions
|
||||
# @internal
|
||||
print_message() {
|
||||
local label="$1" color="$2" message="$3"
|
||||
local prefix="[$label]"
|
||||
local prefix_width=8
|
||||
local pad=$((prefix_width - ${#prefix}))
|
||||
printf '%b%s\033[0m%*s%s\n' "$color" "$prefix" "$pad" '' "$message"
|
||||
}
|
||||
info() { print_message "INFO" '\033[1m' "$*"; }
|
||||
warn() { print_message "WARN" '\033[1;33m' "$*"; }
|
||||
debug() { ((DEBUG)) && print_message "DEBUG" '\033[1m' "$*"; }
|
||||
ok() { print_message "OK" '\033[1;32m' "$*"; }
|
||||
err() { print_message "ERROR" '\033[1;31m' "$*" >&2; }
|
||||
info() { printf '%b[INFO] %s%b\n' '\033[1m' "$*" '\033[0m'; }
|
||||
warn() { printf '%b[WARN] %s%b\n' '\033[1;33m' "$*" '\033[0m'; }
|
||||
debug() { ((DEBUG)) && printf '%b[DEBUG] %s%b\n' '\033[1m' "$*" '\033[0m' >&2; }
|
||||
ok() { printf '%b[OK] %s%b\n' '\033[1;32m' "$*" '\033[0m'; }
|
||||
err() { printf '%b[ERROR] %s%b\n' '\033[1;31m' "$*" '\033[0m' >&2; }
|
||||
ask_ok() {
|
||||
local response
|
||||
((YES_SWITCH)) && return 0
|
||||
|
||||
Reference in New Issue
Block a user