Project

General

Profile

« Previous | Next » 

Revision 9263

lib/sh/util.sh: moved vars echoing before internal commands echoing so that echo_vars can be used in it

View differences:

lib/sh/util.sh
279 279

  
280 280
echo_cmd() { echo_params; }
281 281

  
282
## vars
283

  
284
echo_vars() # usage: echo_vars var...
285
{
286
	log++; log++
287
	if can_log; then
288
		local var
289
		for var in "${@%%=*}"; do
290
			if isset "$var"; then log "$(declare -p "$var")"; fi
291
		done
292
	fi
293
}
294

  
295
echo_export() { builtin export "$@"; echo_vars "$@"; }
296

  
297
if test "$verbosity" -ge 2; then
298
	alias export="echo_export" # automatically echo env vars when they are set
299
fi
300

  
301
func_override kw_params__lang
302
kw_params() { kw_params__lang "$@"; echo_vars "$@"; } # echo all keyword params
303

  
282 304
## internal commands
283 305

  
284 306
.()
......
338 360
}
339 361
alias echo_func='"echo_func" "$@" && indent || true'
340 362

  
341
## vars
342 363

  
343
echo_vars() # usage: echo_vars var...
344
{
345
	log++; log++
346
	if can_log; then
347
		local var
348
		for var in "${@%%=*}"; do
349
			if isset "$var"; then log "$(declare -p "$var")"; fi
350
		done
351
	fi
352
}
353

  
354
echo_export() { builtin export "$@"; echo_vars "$@"; }
355

  
356
if test "$verbosity" -ge 2; then
357
	alias export="echo_export" # automatically echo env vars when they are set
358
fi
359

  
360
func_override kw_params__lang
361
kw_params() { kw_params__lang "$@"; echo_vars "$@"; } # echo all keyword params
362

  
363

  
364 364
### external command input/output
365 365

  
366 366
# usage: cmd1 | { pipe_delay; cmd2; }

Also available in: Unified diff