Project

General

Profile

« Previous | Next » 

Revision 9678

lib/sh/util.sh: usage comments: when there is a descriptive comment on the same line as the usage, prepend it with # (as if it were an end-of-line comment) instead of enclosing it in (), to make it visually obvious that it's a comment and not part of the usage commands

View differences:

lib/sh/util.sh
105 105

  
106 106
alias self='command "$FUNCNAME"' # usage: wrapper() { self ...; }
107 107

  
108
pf() { declare -f "$@"; } # usage: pf function (prints func decl for debugging)
108
pf() { declare -f "$@"; } # usage: pf function # prints func decl for debugging
109 109

  
110 110
all_funcs() # usage: for func in $(all_funcs); do ...; done # all declared funcs
111 111
{ declare -F|while read -r line; do echo -n "${line#declare -f } "; done; }
......
142 142

  
143 143
ignore_sig() { ignore "$(sig_e "$1")"; }
144 144

  
145
# usage: piped_cmd cmd1...|cmd2... (which doesn't read all its input)
145
# usage: piped_cmd cmd1...|cmd2... # cmd2 doesn't read all its input
146 146
function piped_cmd() { "$@" || ignore_sig SIGPIPE; }
147 147
alias piped_cmd='"piped_cmd" ' # last space alias-expands next word
148 148

  
......
312 312

  
313 313
log_info() { symbol=: log_custom "$@"; }
314 314

  
315
die() # usage: cmd || [type=...] die msg (msg can use $? but not $())
315
die() # usage: cmd || [type=...] die msg # msg can use $? but not $()
316 316
{ save_e; kw_params type; "log_${type:-err}" "$1"; rethrow; }
317 317

  
318 318
die_e() # usage: cmd || [benign_error=1] die_e [|| handle error]

Also available in: Unified diff