Project

General

Profile

« Previous | Next » 

Revision 12807

lib/sh/util.sh: highlight_msg(): support custom format

View differences:

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:+}$1${highlight:+}"
493
	echo "${highlight:+[${format}m}$1${highlight:+}"
492 494
}
493 495

  
494 496
log() # highlights log_level 1 messages to stand out against other output

Also available in: Unified diff