Project

General

Profile

« Previous | Next » 

Revision 12692

lib/runscripts/util.run: support custom handlers for all targets (gateway()) as well as targets w/o function (fallback())

View differences:

trunk/lib/runscripts/util.run
33 33
	include_args=("$@") # from `. .../util.run "$@"`
34 34
fi
35 35

  
36
fallback() { echo_func; "$@"; } # overridable handler for targets w/o function
37

  
38
gateway() # overridable handler for *all* targets
39
{ echo_func; if func_exists "$1"; then "$@"; else fallback "$@"; fi; }
40

  
36 41
run_args_cmd() # runs the command line args command
37 42
{
38 43
	if is_dot_script; then set -- "${include_args[@]}"
39 44
	else              eval set -- "$(reverse "${BASH_ARGV[@]}")"
40 45
	fi
41 46
	test $# -ge 1 || set -- all
42
	echo_cmd "$top_script" "$@"; time "$@"
47
	echo_cmd "$top_script" "$@"; time gateway "$@"
43 48
}
44 49

  
45 50
# users can override run_args_cmd to perform other commands (or no commands)

Also available in: Unified diff