Project

General

Profile

« Previous | Next » 

Revision 9273

lib/sh/util.sh: moved functions echoing section before other types of echoing so they can use echo_func()

View differences:

lib/sh/util.sh
300 300
func_override kw_params__lang
301 301
kw_params() { kw_params__lang "$@"; echo_vars "$@"; } # echo all keyword params
302 302

  
303
## functions
303 304

  
305
# usage: func() { [minor=1] echo_func; ... }
306
function echo_func() # usage: [minor=1] "echo_func" "$@" && indent || true
307
# exit status: whether function call was echoed
308
{
309
	kw_params minor
310
	
311
	log++; if test "$minor"; then log++; fi
312
	local script="$(canon_rel_path "${BASH_SOURCE[1]}")"
313
	echo_cmd "$script:${BASH_LINENO[0]}" "${FUNCNAME[1]}" "$@"
314
	can_log
315
}
316
alias echo_func='"echo_func" "$@" && indent || true'
317

  
318

  
304 319
#### paths
305 320

  
306 321
top_script_abs="$(realpath "$0")"; echo_vars top_script_abs # outermost script
......
362 377
# auto-echo common external commands
363 378
for cmd in env rm; do alias "$cmd=command $cmd"; done; unset cmd
364 379

  
365
## functions
366 380

  
367
# usage: func() { [minor=1] echo_func; ... }
368
function echo_func() # usage: [minor=1] "echo_func" "$@" && indent || true
369
# exit status: whether function call was echoed
370
{
371
	kw_params minor
372
	
373
	log++; if test "$minor"; then log++; fi
374
	local script="$(canon_rel_path "${BASH_SOURCE[1]}")"
375
	echo_cmd "$script:${BASH_LINENO[0]}" "${FUNCNAME[1]}" "$@"
376
	can_log
377
}
378
alias echo_func='"echo_func" "$@" && indent || true'
379

  
380

  
381 381
### external command input/output
382 382

  
383 383
pipe_delay () # usage: cmd1 | { pipe_delay; cmd2; }

Also available in: Unified diff