Project

General

Profile

« Previous | Next » 

Revision 12841

lib/sh/util.sh: highlight_msg(): auto-add padding around text if there is a background

View differences:

trunk/lib/sh/util.sh
511 511
{
512 512
	kw_params format; local format="${format-1}" # bold
513 513
	if ! can_highlight_msg; then format=; fi
514
	if has_bg "$format"; then set -- " $1 "; fi # auto-add padding if has bg
514 515
	echo "${format:+[0;${format}m}$1${format:+}"
515 516
}
516 517

  
......
527 528

  
528 529
bg_r='101;97' # red background with white text
529 530

  
530
log_err() { symbol='#' format="$bg_r" log_fd="$err_fd" log! log_custom " $1 ";}
531
log_err() { symbol='#' format="$bg_r" log_fd="$err_fd" log! log_custom "$@";}
531 532

  
532 533
log_info() { symbol=: log_custom "$@"; }
533 534

  
534
mk_hint() { format=7 highlight_msg " $1 "; }
535
mk_hint() { format=7 highlight_msg "$@";}
535 536

  
536 537
log_hint!() { log_info "$(mk_hint "$@")"; }
537 538

  

Also available in: Unified diff