Revision 9183
Added by Aaron Marcuse-Kubitza almost 12 years ago
lib/sh/util.sh | ||
---|---|---|
234 | 234 |
## functions |
235 | 235 |
|
236 | 236 |
# usage: func() { echo_func; ... } |
237 |
function echo_func() # usage: "echo_func" "$@" |
|
237 |
function echo_func() # usage: if "echo_func" "$@"; then indent; fi |
|
238 |
# exit status: whether function call was echoed |
|
238 | 239 |
{ |
239 | 240 |
log++ |
240 | 241 |
local script="$(canon_rel_path "${BASH_SOURCE[1]}")" |
241 | 242 |
echo_cmd "$script:${BASH_LINENO[0]}" "${FUNCNAME[1]}" "$@" |
243 |
can_log |
|
242 | 244 |
} |
243 |
alias echo_func='{ "echo_func" "$@"; indent; }'
|
|
244 |
alias echo_minor_func='{ (log++; "echo_func" "$@"); indent; }'
|
|
245 |
alias echo_func='{ if "echo_func" "$@"; then indent; fi; }'
|
|
246 |
alias echo_minor_func='{ if (log++; "echo_func" "$@"); then indent; fi; }'
|
|
245 | 247 |
|
246 | 248 |
## vars |
247 | 249 |
|
Also available in: Unified diff
lib/sh/util.sh: echo_func: only indent if the function call was displayed. this avoids confusing extra whitespace when a function call causes an indent but the function call itself isn't printed.