Revision 12807
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
485 | 485 |
|
486 | 486 |
can_highlight_msg() { test "$log_level" -le 1; } |
487 | 487 |
|
488 |
highlight_msg() |
|
488 |
highlight_msg() # usage: [format=...] highlight_msg msg |
|
489 |
# format: the # in xfree86.org/current/ctlseqs.html#Character_Attributes |
|
489 | 490 |
{ |
491 |
kw_params format; local format="${format-4}" # underline |
|
490 | 492 |
local highlight="$(can_highlight_msg; exit2bool)" |
491 |
echo "${highlight:+[4m}$1${highlight:+[0m}"
|
|
493 |
echo "${highlight:+[${format}m}$1${highlight:+[0m}"
|
|
492 | 494 |
} |
493 | 495 |
|
494 | 496 |
log() # highlights log_level 1 messages to stand out against other output |
Also available in: Unified diff
lib/sh/util.sh: highlight_msg(): support custom format