Project

General

Profile

« Previous | Next » 

Revision 9435

lib/sh/util.sh: use simpler `if can_log; then indent; fi` instead of `can_log && indent || true`. however, the `&& indent || true` syntax is still required in aliases such as echo_func which need to allow prefixing the command with a wrapper command or kw param assignments.

View differences:

lib/sh/util.sh
506 506
.()
507 507
{
508 508
	cmd2rel_path; set -- "$FUNCNAME" "$@"
509
	(log++; echo_params; can_log) && indent || true
509
	if (log++; echo_params; can_log); then indent; fi
510 510
	builtin "$@"
511 511
}
512 512

  
......
514 514
{
515 515
	log++ echo_func
516 516
	cmd2rel_path; echo_cmd "$FUNCNAME" "$@"
517
	can_log && caller_indent || true
517
	if can_log; then caller_indent; fi
518 518
	# -P: expand symlinks so $PWD matches the output of realpath
519 519
	builtin "$FUNCNAME" -P "$@"
520 520
	
......
534 534
	# if no cmd_log_fd, limit log_fd in case command uses util.sh
535 535
	local cmd_log_fd="${cmd_log_fd-$log_fd}"
536 536
	
537
	cmd2rel_path; (echo_params; can_log) && indent || true
537
	cmd2rel_path; echo_params; if can_log; then indent; fi
538 538
	(
539 539
		# the following redirections must happen in exactly this order
540 540
		if test "$cmd_log_fd"; then command__set_fds; fi

Also available in: Unified diff