lib/sh/util.sh: moved primitives sections before more complex sections that depend on them
lib/sh/util.sh: 2nd functions section: moved to 1st functions section
bugfix: lib/sh/util.sh: added workaround for bash bug where exit sometimes inxeplicably ignores $?
fix: lib/sh/util.sh: self_builtin: avoid $() so that $? isn't modified
lib/sh/util.sh: use new self_builtin
lib/sh/util.sh: added self_builtin
lib/sh/util.sh: pv(), pf(): moved to debugging section
bugfix: lib/sh/util.sh: stderr_matches(): also need to handle any filter error, such as caused by Ctrl+C
lib/sh/util.sh: stderr_matches(): echo_vars @PIPESTATUS_ to assist debugging
bugfix: lib/sh/util.sh: stderr2stdout(): use piped_cmd to ignore SIGPIPE since the output of this will piped to another command
lib/sh/util.sh: setup_log_fd(): $log_fd: use 3 (stdlog) since other scripts are likely to use this for logging as well
fix: lib/sh/util.sh: setup_log_fd(): fd_set_default(): use $log_fd instead of repeating the value of it
lib/sh/util.sh: die(): log at higher log_level, since this is logging code
lib/sh/util.sh: highlight_log_msg(): log at higher log_level, since this is logging code
bugfix: lib/sh/util.sh: stderr_matches(): only set benign_error=1 if the matched error occurred
lib/sh/util.sh: ignore_e(): also set benign_error=1
fix: lib/sh/util.sh: prep_try alias: removed inaccurate comment
bugfix: lib/sh/util.sh: stdout2fd(): moved after redir() which it depends on
fix: lib/sh/util.sh: command(): moved `|| die_e` to command__exec so it would be properly indented under the echoed command
lib/sh/util.sh: verbosity_compat(): log at higher log_level because it's logging code
lib/sh/util.sh: $benign_error: log at higher log_level because it's logging code
lib/sh/util.sh: $top_* vars, $is_outermost: log at higher log_level because it's startup code
lib/sh/util.sh: $top_script: echo_vars this like the other $top_* vars
lib/sh/util.sh: .(): log at higher log_level because it's startup code
lib/sh/util.sh: is_dot_script(): run with higher log_level since this is run at the beginning of the script
lib/sh/util.sh, runscripts/util.run: set_paths(): run with higher log_level to hide all the paths that are set at the beginning of the script
lib/sh/util.sh: added log++ stub
lib/sh/util.sh: added log_local stub
lib/sh/util.sh: added log() stub so internal commands can use it
fix: lib/sh/util.sh: echo_vars(): log at same log_level as echo_func so kw_params are displayed along with positional params
fix: lib/sh/util.sh: rel_path(): log this internal command at a higher log_level so it's normally hidden
fix: lib/sh/util.sh: log_msg!(): log split_lines at a higher log_level so it's normally hidden
bugfix: lib/sh/util.sh: stderr_matches(): `log_local; log++` should apply to just stdout_contains() and part of stderr2stdout() rather than all of stderr_matches()
lib/sh/util.sh: stderr_matches(): run at higher log_level because error-handling internals should not be logged by default
bugfix: lib/sh/util.sh: stderr_matches(): handle any error: only ignore_e if the error exit status was associated with the matched error message
bugfix: lib/sh/util.sh: stderr_matches(): handle any error: need force-exit with rethrow_exit() because caller's test of return status disables errexit
lib/sh/util.sh: added rethrow_exit(), which exits even where errexit is disabled
lib/sh/util.sh: sudo alias: use function instead so this can be overridden
lib/sh/util.sh: added is_intern()
lib/sh/util.sh: is_callable(): use just $1 because multiple args are not applicable
lib/sh/util.sh: added is_world_executable()
lib/sh/util.sh: added has_perms()
lib/sh/util.sh: esc_args(): renamed to just esc() because this can also be used on a single value
lib/sh/util.sh: added is_extern()
lib/sh/util.sh: added sudo alias to alias-expand command
lib/sh/util.sh: added $sudo
lib/sh/util.sh: added cp alias
bugfix: lib/sh/util.sh: local_array/export_array: do need -a because that it's an array is apparently not autodetected by the () on Mac
lib/sh/util.sh: import_vars: documented that vars already set will not be overwritten
lib/sh/util.sh: removed end_try_subshell, which now does the same thing as end_try
bugfix: lib/sh/util.sh: die(): usage: documented that if msg uses $(...), save_e is needed
bugfix: lib/sh/util.sh: already_exists_msg(): need to save_e, because new $(mk_hint) call resets $?
lib/sh/util.sh: die(): always errexit even if $e = 0, because die always indicates an error
lib/sh/util.sh: added rethrow!(), which always errexits, even if $e = 0
lib/sh/util.sh: rethrow(): also work in situations where $e is not set
lib/sh/util.sh: rethrow: made it a function since there is now no need for it to be an alias
lib/sh/util.sh: rethrow: removed `test "$e" != 0` since errexit only does anything if $e != 0
lib/sh/util.sh: removed separate rethrow_exit*, rethrow_subshell*, since they now do the same thing as rethrow*
lib/sh/util.sh: rethrow*!: use new errexit, which works in functions and subshells
lib/sh/util.sh: added errexit(), used in place of (exit "$1") because a bug in bash prevents subshells from triggering errexit
lib/sh/util.sh: added bool!()
fix: lib/sh/util.sh: redir(): need to indent before invoking an external command (not just in command__exec(), but for all redir() calls)
lib/sh/util.sh: filesystem: added is_*(), could_be_*()
lib/sh/util.sh: added contains_match()
lib/sh/util.sh: added ends_with()
bugfix: lib/sh/util.sh: DON'T do `shopt -s lastpipe` because this causes a segfault on Linux in stderr_matches(). (it also isn't supported on Mac.) use @PIPESTATUS instead. note that we do not currently need lastpipe, since we use @PIPESTATUS (which actually provides more functionality for our purposes).
fix: lib/sh/util.sh: echo_func(): file/line #: display with regular color because the lighter color actually draws attention to rather than away from the faded text
lib/sh/util.sh: added plain()
fix: lib/sh/util.sh: fade(): use medium gray instead of light gray because it fades on white and black backgrounds
lib/sh/util.sh: echo_func(): fade the file/line # to avoid distracting from the function call in the default log output
lib/sh/util.sh: added fade()
lib/sh/util.sh: highlight_msg(): renamed to highlight_log_msg() to clarify that this contains log++-specific functionality
lib/sh/util.sh: moved terminal formatting commands to own section
lib/sh/util.sh: highlight_msg(): moved formatting code into separate format() function
lib/sh/util.sh: dp(): renamed to ps() to corresponding with pv/pf
lib/sh/util.sh: echo_func(): put file/line # after function call instead of before so the function name is listed first
lib/sh/util.sh: echo_func(): usage: removed no longer used/implemented minor=1 switch. use log++ instead.
lib/sh/util.sh: ignore_err_msg(): usage: added $ignore_e param from stderr_matches()
lib/sh/util.sh: log_hint(): renamed to log_err_hint() for clarity, because this applies only to hints for errors
bugfix: lib/sh/util.sh: log_hint!(): use log_err instead of log_info because hints as used here are attached to (possibly benign) errors. for other uses, use mk_hint().
fix: lib/sh/util.sh: highlight_msg(): don't ' '-pad already-formatted text
lib/sh/util.sh: manual terminal escape sequences: use highlight_msg() instead
lib/sh/util.sh: highlight_msg(): auto-add padding around text if there is a background
lib/sh/util.sh: highlight_msg(): use $format itself as the $highlight boolean
lib/sh/util.sh: highlight_msg(): split apart the testing of $format and can_highlight_msg
lib/sh/util.sh: added has_bg()
bugfix: lib/sh/util.sh: highlight_msg(): need to reset any existing formatting before applying new formatting
lib/sh/util.sh: added mk_hint() and use it in log_hint!()
lib/sh/util.sh: bg_cmd(): also log the command being run
fix: lib/sh/util.sh: need `function` before functions that have an alias with the same name
lib/sh/util.sh: log!(): use new log:()
lib/sh/util.sh: added log:(), which sets an explicit log_level. this also simplifies log+().
lib/sh/util.sh: log+(): set log_level before PS4 so that the PS4 expr doesn't also need to add to log_level
lib/sh/util.sh: removed no longer needed log+ alias (which had been renamed from clog+)
lib/sh/util.sh: clog*: renamed to log* for clarity (possible now that log* is no longer used for function-local log_level setting)
: local setting of log_level: use log_local instead of relying on the log aliases, so that these aliases can instead be used for wrapping commands (the more common use case)
bugfix: lib/sh/util.sh: verbosity_compat alias: need to use `declare verbosity="$verbosity"` instead of `declare verbosity`, which would just clear $verbosity
bugfix: lib/sh/util.sh: verbosity_min alias: need to use `declare verbosity="$verbosity"` instead of log_local now that verbosity is not one of the vars changed by log++
lib/sh/util.sh: log+(): use easier-to-understand log_local instead of prefix-assignments to limit assignments to the invoked command