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()
bugfix: lib/sh/db.sh: pg_table_exists(): need ! to negate boolean result
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/make.sh: echo_target: use `log-- echo_func`, which now puts the target name first but also provides much-needed indentation
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()
fix: lib/sh/db.sh: pg_cmd(): hide PGPASSWORD at the normal verbosity so that the value of it doesn't appear in any log files
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
: use clog instead of "log*"
bugfix: lib/sh/util.sh: log+(): removed spurious ; between setting of PS4 and log_level, which was causing erratic mismatches between PS4 and log_level. (the ; caused $PS4 to be set in the caller when invoked via one of the clog* aliases, rather than being passed as a command-specific env var.)
lib/sh/util.sh: $verbosity: stay constant at what the user set it to instead of changing in tandem with $log_level, to facilitate debugging verbosity/log_level-related issues
lib/sh/util.sh: log+(): usage: use aliases instead of ""-ed function names
lib/sh/util.sh: log_err(): use red background for better visibility of errors, in the same way that lib/exc.py print_ex() does for column-based import
bugfix: lib/sh/util.sh: removed echo_func in functions used by log++, to avoid spurious highlighted output
lib/sh/util.sh: added missing clog+ alias
bugfix: lib/sh/util.sh: log_hint(): use the standard log_fd and log_info() format, not err_fd and log_err() format, for hint messages
fix: lib/sh/util.sh: log_msg!(): indent each line, not just the first
lib/sh/util.sh: added split_lines()
lib/sh/util.sh: log(): factored out helper function log_msg!()
fix: lib/sh/util.sh: highlight_msg(): bold instead of underlining because the underlining interferes with the readability of the commands
lib/sh/util.sh: highlight_msg(): allow turning off formatting w/ empty $format
fix: lib/sh/util.sh: log_err() calls: removed manual highlighting
lib/sh/util.sh: log_err(): highlight all error messages using highlight_msg()'s new $format
lib/sh/util.sh: highlight_msg(): support custom format
lib/sh/db.sh: pg_*_exists(): log the DB statements to check this at a higher log_level so that they don't clutter up the log output
lib/sh/util.sh: log(): highlight log_level 1 messages to stand out against other output, for easier debugging
bugfix: catch(): also need to support $1='' because this is a now a use case of ignore_e()
bugfix: lib/sh/util.sh: ignore_err_msg(): also need to ignore false exit status on no match
lib/sh/util.sh: stderr_matches(): moved prep_try/rethrow into the function itself so that callers don't have to wrap this function in a complex sequence of prep_try/rethrow statements
*{.sh,run}: stderr_matches() wrapper calls: removed no longer needed prep_try/rethrow
lib/sh/util.sh: added rethrow_exit alias
fix: lib/sh/db.sh: pg_table_exists(): use stderr_matches() rather than just the exit status. this also avoids highlighting the benign error.
lib/sh/make.sh: begin_target: echo all targets to facilitate debugging without needing the verbose stack trace mode
bugfix: lib/sh/make.sh: echo_target: don't include filename/line #, since this is not for the stack trace mode
lib/sh/make.sh: added echo_target
*{.sh,run}: use new begin_target instead of `echo_func; set_make_vars`
lib/sh/make.sh: added make target template
lib/sh/make.sh: added begin_target alias
bugfix: lib/sh/util.sh: rethrow*: only `return` if $e is actually nonzero, because rethrow is now being used as a catch-all in situations where there might not be an error
lib/sh/util.sh: prep_try: initialize $e to 0 to simplify error-handling coding
stderr_matches(): wrapper caller usage: added alternative usage when using `||`
lib/sh/util.sh: stderr_matches(): wrapper caller usage: documented usage for a negated condition (ie. prefixed w/ !)
lib/sh/util.sh: stderr_matches(): usage: split into wrapper usage and wrapper caller usage for clarity
fix: *{.sh,run}: stderr_matches() wrappers: usage: added `rethrow`
fix: lib/sh/util.sh: stderr_matches(): usage: `rethrow` must be called right after stderr_matches(), to avoid calling running other commands if there is an error
fix: lib/sh/util.sh: stderr_matches(): when using $ignore_e, also set benign_error=1 to suppress the highlighting of the error
bugfix: lib/sh/db.sh: pg_schema_exists(): need to ignore benign error exit status from the "cannot create temporary relation in non-temporary schema" error
lib/sh/util.sh: stderr_matches(): supporting ignoring any benign error exit status associated with the error message being tested for
lib/sh/util.sh: stderr_matches(): usage: documented where any ignore_e statement would go
bugfix: lib/sh/util.sh: stderr_matches(): can't use `try` because this clears the exit status, which is needed for @PIPESTATUS to work. to support this, also need to avoid errexiting since @PIPESTATUS will be used instead.
lib/sh/util.sh: added dp(), which debug-prints a message
lib/sh/db.sh: psql(): $verbose_ok: renamed to $bypass_ok for clarity, because this applies only to the `--output /dev/fd/41` bypass (which when not possible, requires turning off verbose output
fix: lib/sh/db.sh: psql(): added $output_data switch analogous to what mysql() has. this causes query results of eg. void-returning functions to be correctly filtered by the logging mechanism, rather than output to stdout.
fix: lib/sh/db.sh: psql(): verbosity=0 (errors only) mode: use `SET client_min_messages = WARNING;` instead of NOTICE to hide verbose messages within psql as well
lib/sh/db.sh: psql(): replaced `test "$verbose_ok" && can_log` with bool var $verbose_
fix: lib/sh/db.sh: psql(): $verbose_: renamed to $verbose_ok for clarity
fix: lib/sh/util.sh: stdout_contains(): add another pipe_delay because the `grep` statement was sometimes getting printed before its filtered output
bugfix: lib/sh/util.sh: die_error_hidden(): min verbosity to display error should not be hardcoded
lib/sh/db.sh: psql(): "to see error details" msg: use new die_error_hidden()
lib/sh/util.sh: added die_error_hidden()
lib/sh/db.sh: psql(): "to see error details" msg: use new log_hint()
lib/sh/util.sh: added log_hint(), whose msg is only displayed if not a benign error
bugfix: lib/sh/db.sh: psql(): "to see error details" msg: also don't print it for benign errors ($benign_error)
lib/sh/db.sh: psql(): on error, display message describing how to see error details (prepend `vb=2` to the command)
bugfix: lib/sh/util.sh: log_err(): don't override verbosity manually, as this will not set log_level or PS4. instead, use new log! , which sets these correctly.
lib/sh/util.sh: added log! , which force-displays next log message
lib/sh/util.sh: save_e: made it idempotent so that it also works if save_e was already called