Revision 9186
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
233 | 233 |
|
234 | 234 |
## functions |
235 | 235 |
|
236 |
# usage: func() { echo_func; ... } |
|
237 |
function echo_func() # usage: "echo_func" "$@" && indent || true |
|
236 |
# usage: func() { [minor=1] echo_func; ... }
|
|
237 |
function echo_func() # usage: [minor=1] "echo_func" "$@" && indent || true
|
|
238 | 238 |
# exit status: whether function call was echoed |
239 | 239 |
{ |
240 |
log++ |
|
240 |
log++; if test "$minor"; then log++; fi
|
|
241 | 241 |
local script="$(canon_rel_path "${BASH_SOURCE[1]}")" |
242 | 242 |
echo_cmd "$script:${BASH_LINENO[0]}" "${FUNCNAME[1]}" "$@" |
243 | 243 |
can_log |
244 | 244 |
} |
245 | 245 |
alias echo_func='"echo_func" "$@" && indent || true' |
246 |
alias echo_minor_func='(log++; "echo_func" "$@") && indent || true'
|
|
246 |
alias echo_minor_func='minor=1 echo_func'
|
|
247 | 247 |
|
248 | 248 |
## vars |
249 | 249 |
|
Also available in: Unified diff
lib/sh/util.sh: echo_func: support using minor=1 to increase the log_level that the function call is echoed at. use this in echo_minor_func.