refactor(script): Define color codes just once (#1)
This commit is contained in:
parent
ce93c8558e
commit
2fadc427c5
@ -30,9 +30,12 @@ if [[ ! "${snap_op_remove_suffix}" ]]; then snap_op_remove_suffix='rmvl'; fi
|
|||||||
if [[ ! "${snap_op_upgrade_suffix}" ]]; then snap_op_upgrade_suffix='upgr'; fi
|
if [[ ! "${snap_op_upgrade_suffix}" ]]; then snap_op_upgrade_suffix='upgr'; fi
|
||||||
|
|
||||||
# Internal
|
# Internal
|
||||||
declare pkg_separator max_zfs_snapshot_name_length
|
declare pkg_separator max_zfs_snapshot_name_length color_reset color_lyellow color_red
|
||||||
pkg_separator=':'
|
pkg_separator=':'
|
||||||
max_zfs_snapshot_name_length='255'
|
max_zfs_snapshot_name_length='255'
|
||||||
|
color_reset='\e[0m'
|
||||||
|
color_lyellow='\e[93m'
|
||||||
|
color_red='\e[31m'
|
||||||
|
|
||||||
declare operation conf_op_suffix
|
declare operation conf_op_suffix
|
||||||
operation="${1}"
|
operation="${1}"
|
||||||
@ -54,11 +57,6 @@ function pprint () {
|
|||||||
msg="${2:?}"
|
msg="${2:?}"
|
||||||
exit_code="${3}"
|
exit_code="${3}"
|
||||||
|
|
||||||
local color_reset color_lyellow
|
|
||||||
color_reset='\e[0m'
|
|
||||||
color_lyellow='\e[93m'
|
|
||||||
color_red='\e[31m'
|
|
||||||
|
|
||||||
case "${style}" in
|
case "${style}" in
|
||||||
warn)
|
warn)
|
||||||
printf -- "${color_lyellow}"'[WARN]'"${color_reset}"' %s\n' "${msg}"
|
printf -- "${color_lyellow}"'[WARN]'"${color_reset}"' %s\n' "${msg}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user