mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-12-25 08:30:05 -07:00
kiss: Added KISS_COLOR to control color output
This commit is contained in:
parent
dd825b0a14
commit
f5d0fe0a5f
14
kiss
14
kiss
@ -15,12 +15,10 @@ log() {
|
|||||||
# All messages are printed to stderr to allow the user to hide build
|
# All messages are printed to stderr to allow the user to hide build
|
||||||
# output which is the only thing printed to stdout.
|
# output which is the only thing printed to stdout.
|
||||||
#
|
#
|
||||||
# '\033[1;32m' Set text to color '2' and make it bold.
|
# The l<word> variables contain escape sequence which are defined
|
||||||
# '\033[m': Reset text formatting.
|
# when '$KISS_COLOR' is equal to '1'.
|
||||||
# '${3:-->}': If the 3rd argument is missing, set prefix to '->'.
|
printf '%b%s %b%s%b %s\n' \
|
||||||
# '${2:+\033[1;3Xm}': If the 2nd argument exists, set text style of '$1'.
|
"$lcol" "${3:-->}" "${lclr}${2:+$lcol2}" "$1" "$lclr" "$2"
|
||||||
printf '\033[1;33m%s \033[m%b%s\033[m %s\n' \
|
|
||||||
"${3:-->}" "${2:+\033[1;36m}" "$1" "$2" >&2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
war() {
|
war() {
|
||||||
@ -1590,6 +1588,10 @@ main() {
|
|||||||
# as the environment variable should always be defined.
|
# as the environment variable should always be defined.
|
||||||
[ "$KISS_PATH" ] || die "\$KISS_PATH needs to be set"
|
[ "$KISS_PATH" ] || die "\$KISS_PATH needs to be set"
|
||||||
|
|
||||||
|
# Allow the user to disable colors in output via an environment variable.
|
||||||
|
# Check this once so as to not slow down printing.
|
||||||
|
[ "$KISS_COLOR" = 0 ] || lcol='\033[1;33m' lcol2='\033[1;36m' lclr='\033[m'
|
||||||
|
|
||||||
# Set the location to the repository and package database.
|
# Set the location to the repository and package database.
|
||||||
pkg_db=var/db/kiss/installed
|
pkg_db=var/db/kiss/installed
|
||||||
|
|
||||||
|
5
kiss.1
5
kiss.1
@ -93,6 +93,11 @@ export KISS_HOOK=/path/to/script
|
|||||||
# This can be used to have the package manager run in a "fake root".
|
# This can be used to have the package manager run in a "fake root".
|
||||||
export KISS_ROOT=/
|
export KISS_ROOT=/
|
||||||
|
|
||||||
|
# Whether or not to color package manager output messages.
|
||||||
|
#
|
||||||
|
# Set it to '0' to disable.
|
||||||
|
export KISS_COLOR=1
|
||||||
|
|
||||||
# Keep build logs around for successful builds and not just failing
|
# Keep build logs around for successful builds and not just failing
|
||||||
# ones. Helpful when debugging.
|
# ones. Helpful when debugging.
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user