mirror of
https://github.com/m8tin/cis.git
synced 2026-08-01 11:47:31 +02:00
print module improved
This commit is contained in:
+26
-10
@@ -23,6 +23,14 @@ function print.data() {
|
||||
return 1
|
||||
}
|
||||
|
||||
#Function, to print done status.
|
||||
function print.done() {
|
||||
base.printWithColor LIGHTGREEN "(done)\n" >&2 \
|
||||
&& return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#Function, for uncorrectable errors.
|
||||
function print.error() {
|
||||
local _MESSAGE="${@:-""}"
|
||||
@@ -31,7 +39,7 @@ function print.error() {
|
||||
&& base.printWithColor LIGHTRED "ERROR!\n" >&2 \
|
||||
&& return 0
|
||||
|
||||
base.printWithColor LIGHTRED "ERROR!\n" >&2 \
|
||||
base.printWithColor LIGHTRED "ERROR:" >&2 \
|
||||
&& base.printWithColor WHITE " ${_MESSAGE}\n" >&2 \
|
||||
&& return 0
|
||||
|
||||
@@ -48,6 +56,14 @@ function print.essential() {
|
||||
return 1
|
||||
}
|
||||
|
||||
#Function, to print fail status.
|
||||
function print.fail() {
|
||||
base.printWithColor LIGHTRED "(FAIL)\n" >&2 \
|
||||
&& return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#Function, for failures.
|
||||
function print.failure() {
|
||||
[ "${1:+isset}" != "isset" ] \
|
||||
@@ -121,12 +137,12 @@ function print.info() {
|
||||
local _DECRIPTION="${@:-""}"
|
||||
|
||||
[ -z "${_DECRIPTION:-""}" ] \
|
||||
&& base.printWithColor LIGHTBLUE "INFO:\n" >&2 \
|
||||
&& base.printWithColor LIGHTBLUE "INFO:" >&2 \
|
||||
&& base.printWithColor WHITE " ${_MESSAGE}\n" >&2 \
|
||||
&& return 0
|
||||
|
||||
base.printWithColor LIGHTBLUE "INFO - " >&2 \
|
||||
&& base.printWithColor WHITE "${_MESSAGE}:\n" >&2 \
|
||||
base.printWithColor LIGHTBLUE "INFO:" >&2 \
|
||||
&& base.printWithColor WHITE " ${_MESSAGE}:\n" >&2 \
|
||||
&& base.printWithColor LIGHTGREY "${_DECRIPTION}\n" >&2 \
|
||||
&& return 0
|
||||
|
||||
@@ -178,7 +194,7 @@ function print.success() {
|
||||
&& base.printWithColor LIGHTGREEN "SUCCESS!\n" >&2 \
|
||||
&& return 0
|
||||
|
||||
base.printWithColor LIGHTGREEN "SUCCESS!\n" >&2 \
|
||||
base.printWithColor LIGHTGREEN "SUCCESS:" >&2 \
|
||||
&& base.printWithColor WHITE " ${_MESSAGE}\n" >&2 \
|
||||
&& return 0
|
||||
|
||||
@@ -189,11 +205,11 @@ function print.success() {
|
||||
function print.tip() {
|
||||
local _MESSAGE="${1:?"print.tip(): Missing first parameter MESSAGE."}"
|
||||
|
||||
base.printWithColor CYAN "TIP:\n" >&2
|
||||
while [ "${_MESSAGE:-""}" != "" ]; do
|
||||
base.printWithColor LIGHTGREY " ${_MESSAGE}\n" >&2 \
|
||||
base.printWithColor CYAN "TIP:" >&2 \
|
||||
&& base.printWithColor WHITE " ${_MESSAGE}\n" >&2
|
||||
while [ -n "${2}" ]; do
|
||||
base.printWithColor LIGHTGREY " ${2}\n" >&2 \
|
||||
&& shift \
|
||||
&& _MESSAGE="${1:-""}" \
|
||||
&& continue
|
||||
return 1
|
||||
done
|
||||
@@ -205,7 +221,7 @@ function print.tip() {
|
||||
function print.warn() {
|
||||
local _MESSAGE="${@:?"print.warn(): Missing first parameter MESSAGE."}"
|
||||
|
||||
base.printWithColor YELLOW "WARNING:\n" >&2 \
|
||||
base.printWithColor YELLOW "WARNING:" >&2 \
|
||||
&& base.printWithColor WHITE " ${_MESSAGE}\n" >&2 \
|
||||
&& return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user