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