Project

General

Profile

Statistics
| Revision:

# Date Author Comment
9297 05/12/2013 01:54 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: fwd(): need to use $top_dir (the runscript's file) instead of "${BASH_SOURCE1}" (the caller's file)

9296 05/12/2013 01:38 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command__set_fds(): cmd_log_fd = log_fd and can_log: don't call set_fds because no redirection is needed. this also avoids the need to increase the log_level of the set_fds call that used to set cmd_log_fd to itself.

9295 05/12/2013 01:30 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: command__set_fds(): cmd_log_fd = log_fd: need to increase the log_level after can_log is checked, to avoid limiting the command output itself

9294 05/12/2013 01:23 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: command__set_fds(): log the command output at the same log_level as the command name (i.e. leave the log_level as-is), to allow nesting verbose commands within one another without the inner commands always getting suppressed

9293 05/12/2013 01:08 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command__set_fds(): set the src fd outside of the set_fds call, for clarity

9292 05/12/2013 01:02 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): if cmd_log_fd = log_fd, log the filtering of cmd_log_fd at 2 log_levels higher (verbosity >= 3)

9291 05/12/2013 12:57 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): documented that $cmd_log_fd's default (no cmd_log_fd) limits log_fd in case command uses util.sh

9290 05/12/2013 12:54 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: command(): need to make $cmd_log_fd a local var when setting its default value

9289 05/12/2013 12:49 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: logging: moved indent for call tree to its own section, so it isn't confused with the log_level

9288 05/12/2013 12:40 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: logging: log_level definition: added instructions to view a message's log_level (count the # of + signs before it in the output)

9287 05/12/2013 12:39 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: logging: log_level definition: replaced command with message because not just commands can be logged

9286 05/12/2013 12:38 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: logging: log_level definition: emphasized that the log_level starts with 1, not 0 (0 has a special meaning, which refers to unfiltered messages)

9285 05/12/2013 12:34 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: logging: log_level definition: documented that for commands that use can_log(), the log_level starts with 1. for unfiltered commands, the log_level is 0 (i.e. still output at verbosity=0).

9284 05/12/2013 12:29 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: logging: added definition that the log_level is the minimum verbosity needed to display a command

9283 05/12/2013 12:22 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_global_fds(): documented that the logging output for this is visible at verbosity >= 3

9282 05/12/2013 12:21 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_global_fds(): moved stdlog fd setup to separate setup_log_fd() function, which runs at a much higher log_level (5 instead of 3). because the stdlog fd setup statements themselves are logged to fd 2 (because fd 30 is not yet open), you normally don't want to display these, if you are using fd 2 for errors only and fd 30 for logging.

9281 05/12/2013 12:07 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): $cmd_log_fd: if not set, assume it's a script using util.sh (i.e. with log fd=$log_fd)

9280 05/12/2013 12:00 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_global_fds(): also open stdlog logging stream on fd 30, and use this in the logging functions by setting $log_fd

9279 05/12/2013 11:51 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved streams section before external commands echoing because command() uses set_fds

9278 05/12/2013 11:50 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved echo_eval() to general command echoing section so it can be used by other echoing commands

9277 05/12/2013 11:45 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: don't load new aliases after defining echo_stdout because it's no longer an alias

9276 05/12/2013 11:44 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: load new aliases after defining echo_func

9275 05/12/2013 11:36 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: .(): use "$FUNCNAME" like cd()

9274 05/12/2013 11:36 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: .(): wrapped lines in the same way as cd()

9273 05/12/2013 11:34 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved functions echoing section before other types of echoing so they can use echo_func()

9272 05/12/2013 11:28 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: $verbosity: decreased default value to 1 so that normally, only external commands are echoed. this avoids cluttering up the output with the function call tree, which is really only needed for debugging. it also mirrors make's default verbosity (i.e. print external commands and subdir recursions, but not make's internal actions).

9271 05/12/2013 11:25 AM Aaron Marcuse-Kubitza

*{.sh,run}: put doc comment on next line when possible, so that the function name always comes before it

9270 05/12/2013 11:22 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: put usage message at end of line when possible, so that the function name always comes before it

9269 05/12/2013 11:14 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: $top_script: need to realpath this before doing any cd so this points to the right place. set and use $top_script_abs for this purpose.

9268 05/12/2013 10:34 AM Aaron Marcuse-Kubitza

lib/runscripts/util.run: added setting of $top_file, $top_filename to set_paths()

9267 05/12/2013 10:25 AM Aaron Marcuse-Kubitza

lib/runscripts/util.run: set $top_file, $top_filename in a function (set_paths__util_run())

9266 05/12/2013 10:21 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: cd(): re-run set_paths() to update $top_script, $top_dir for the new current dir

9265 05/12/2013 10:13 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added set_paths(), which sets $top_script, $top_dir

9264 05/12/2013 10:10 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved $top_script, $top_dir before internal commands echoing so they can be reset in cd()

9263 05/12/2013 10:09 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved vars echoing before internal commands echoing so that echo_vars can be used in it

9262 05/12/2013 09:56 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: use set_fds() instead of `echo_eval exec` for clarity

9261 05/12/2013 09:53 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_fd(): allow setting multiple fds at once, and changed the function name accordingly

9260 05/12/2013 09:50 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_fd(): moved noclobber functionality to fd_set_default() since that is only used by fd_set_default() (whose purpose has become just to run set_fd without clobbering an existing dest fd)

9259 05/12/2013 09:40 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: shadow_fd(): renamed to fd_set_default() for clarity (since this can't just be used for shadowing stdin/stdout/stderr)

9258 05/12/2013 09:38 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_fd()/shadow_fd(): take the redirect expr as an arg instead of a kw_param because it's the only param

9257 05/12/2013 09:33 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_fd()/shadow_fd(): take just a redirect expr containing the entire dest[<>]src expr, and parse the dest out from it

9256 05/12/2013 09:29 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_fd()/shadow_fd(): updated usage and kw_params

9255 05/12/2013 09:29 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_fd()/shadow_fd(): updated usage and kw_params

9254 05/12/2013 09:24 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_fd()/shadow_fd(): take just a redirect source expr containing the <> and the fd, to allow the caller to specify these in the shell redirection syntax. this also allows using a file (such as /dev/null) as the redirect source.

9253 05/12/2013 09:11 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added cd() wrapper that logs itself and indents (indent is permanent within subshell cd was used in)

9252 05/12/2013 09:04 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added caller_indent alias

9251 05/12/2013 08:45 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: log_err(): changed symbol to # instead of * so that it stands out better at the outmost indent level and doesn't blend in with the + that will be prefixing other messages

9250 05/12/2013 08:40 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: log_info(): changed symbol to : so that it blends in better with the | lines (looking like a dotted segment of the line), but still stands out (because of the dots)

9249 05/12/2013 08:32 AM Aaron Marcuse-Kubitza

*{.sh,run}: don't use aliases unless it's actually necessary (e.g. to define a var in the calling function, or to alias-expand the next word)

9248 05/12/2013 08:13 AM Aaron Marcuse-Kubitza

lib/runscripts/util.run: $top_file: also match dir-level runscripts by removing /run suffix

9247 05/12/2013 08:13 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: shadow_fd(): take a dest fd instead of a prefix to prepend to the src fd, so that the full name of the dest fd is in the function call. this makes it much clearer what fd will be created from a shadow_fd() call.

9246 05/12/2013 07:59 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: rel_path(): also remove base_dir when path exactly = to it. this involves adding and removing an extra trailing /.

9245 05/12/2013 07:56 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: rel_path(): ensure non-empty by using . if empty

9244 05/12/2013 07:55 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: split canon_rel_path() into itself and rel_path() helper for clarity

9243 05/12/2013 07:47 AM Aaron Marcuse-Kubitza

lib/sh/local.sh: $root_dir: run canon_rel_path on it

9242 05/12/2013 07:37 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: log_custom(): use keyword-args syntax instead of local vars

9241 05/12/2013 07:36 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: log_custom(): replace all non-whitespace chars in PS4 with $symbol instead of just the first one, so there aren't mixed $symbols and PS4 chars

9240 05/12/2013 07:28 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved paths section after logging so it can use logging functions

9239 05/12/2013 06:10 AM Aaron Marcuse-Kubitza

*{.sh,run}: echo all global vars (except those defined before echo_vars is available)

9238 05/12/2013 05:58 AM Aaron Marcuse-Kubitza

web/links/index.htm.run: use the runscript-common $top_file, which is equivalent to $linked_file

9237 05/12/2013 05:55 AM Aaron Marcuse-Kubitza

*{.sh,run}: use new local_export instead of local...export. this still requires calling echo_vars manually, because local_export is an alias (and must be, to define the var in the caller's context).

9236 05/12/2013 05:54 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added local_export alias, which combines the effects of local and export

9235 05/12/2013 05:36 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: renamed params() to kw_params() to clarify the type of params it handles

9234 05/12/2013 05:33 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: logging: echo all keyword params by overriding params(). this requires removing manual echo_vars calls.

9233 05/12/2013 05:31 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved functions section right after exceptions, so that other sections can use it. in particular, func_override is needed by verbose output to override non-verbose versions of functions.

9232 05/12/2013 05:28 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: only try to echo vars that are set, to avoid `declare -p` "not found" errors

9231 05/12/2013 05:09 AM Aaron Marcuse-Kubitza

: use new `params` in all functions that have keyword params, in order to remove their vars from the environment. note that functions that use $? (such as die()) must save it *before running params, because params will overwrite $?.

9230 05/12/2013 04:28 AM Aaron Marcuse-Kubitza

web/links/index.htm: updated to Firefox bookmarks. added bash and MySQL-related bookmarks, including MySQL doc subfolder.

9229 05/12/2013 04:11 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: params(): added doc comment

9228 05/12/2013 04:10 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added params(), which removes keyword-param-only vars from the environment

9227 05/12/2013 03:50 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added unexport() (note that `declare +x` won't work because it defines the var if it isn't set)

9226 05/12/2013 03:39 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved vars section to beginning so other sections can use it (it does not contain logging statements, so it doesn't need to be after verbose output)

9225 05/12/2013 03:34 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: command(): limit cmd_log_fd directly instead of limiting log_fd (usually fd 2) and then redirecting cmd_log_fd to it. this ensures that stderr is not limited unless it's actually used as the cmd_log_fd, so that a non-logging stderr will still reach the user properly regardless of whether err_fd is set to something other than 2. (previously, without an err_fd at 22, closing fd 2 at the beginning of the set of redirections would leave no fd pointing to a place to echo errors to.)

9224 05/11/2013 11:16 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: disable_logging(): use echo_eval instead of plain eval so the disabling of logging is nevertheless itself logged

9223 05/11/2013 11:11 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): made usage message an end-of-line comment

9222 05/11/2013 11:10 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: inlined limit_log_fd into command() since it's only used once

9221 05/11/2013 10:22 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: log_err(), log_info(): use bolder symbols (*, #) to make the symbol stand out visually from the line of | above and below it

9220 05/11/2013 10:09 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: $verbosity: lowered the default from 3 to 2 because level 3 output (vars, etc.) is too verbose for the default output and is only needed for debugging

9219 05/11/2013 10:06 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: $log_level_indent: added space after | to visually separate the nesting levels and make the output look like an expandable tree (similar to a filesystem browser tree)

9218 05/11/2013 10:04 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: log_custom(): replace every non-whitespace character of $log_indent, and the first character of PS4, with the symbol, to make the symbol stand out on the line instead of the |||... before it

9217 05/11/2013 09:19 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: removed no longer used stdout2log_fd(). set $cmd_log_fd instead.

9216 05/11/2013 09:16 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: set $log_level_indent to | because this visually connects commands at the same indent by effectively connecting their + prefixes with a line of |

9215 05/11/2013 09:14 PM Aaron Marcuse-Kubitza

lib/sh/archives.sh: zip(), unzip(): added missing echo_func

9214 05/11/2013 09:07 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): use just one control var $cmd_log_fd instead of three flags (limit_log_fd, limit_stdout, stderr_is_errors) that indicated various common fd configurations. this is much clearer (you state which fd the common uses as its logging fd), more configurable (the logging fd can be any fd, not just 1 or 2), and more automatic (redirecting fd 2 to err_fd happens automatically if it isn't used for logging).

9213 05/11/2013 08:58 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/local.sh: psql(): need to use limit_stdout=1 instead of stderr_is_errors=1 because logging info is output to stdout, not stderr, in spite of the >&2 redirection, since the >&2 is applied after command()'s logging redirects. note that the >&2 can now be removed, because it will be performed by command().

9212 05/11/2013 08:16 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added $log_fd and use it instead of 2 where the log_fd is intended

9211 05/11/2013 08:11 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved stdout2log_fd() to command verbose output subsection of verbose output since it is primarily intended for use with external commands

9210 05/11/2013 08:05 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: renamed limit_stderr to limit_log_fd, stdout2stderr to stdout2log_fd to clarify their purpose. log_fd is currently assumed to be 2.

9209 05/11/2013 08:00 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added disable_logging() and use it instead of `exec 2>/dev/null`

9208 05/11/2013 07:54 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added $err_fd global var and use it instead of the 22 magic value. it starts out at 2 until fd 22 has been set up, so commands that required 22 will now work before set_global_fds() is called.

9207 05/11/2013 07:11 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: shadow_fd(): don't require it to be run with log++ and instead let callers apply log++ if needed. in set_global_fds(), log++ can just be applied once for all the shadow_fd() calls.

9206 05/11/2013 07:09 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: shadow_fd(): instead of applying minor=1 (i.e. an additional log++) to echo_func and then log++ again separately to set_fd, just apply it to the entire function

9205 05/11/2013 07:07 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_fd(): don't increase the log_level for this function, and instead let callers increase it if needed

9204 05/11/2013 06:48 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: limit_stderr(): inlined log++ with the can_log call because it should only apply to it. this also makes it obvious that log++ should not apply outside of this function. this also enables the contents of this function to be used in an alias.

9203 05/11/2013 06:01 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): use exec instead of `builtin command` to avoid spawning an extra process (since a subshell is already open)

9202 05/11/2013 05:43 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: command(): only indent if command was logged

9201 05/11/2013 05:39 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: .(): only indent if include statement was logged

9200 05/11/2013 05:29 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: limit_stderr(): moved $stdout2stderr to command() so that limit_stderr()'s only purpose is to log-limit stderr

9199 05/11/2013 05:23 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: limit_stderr(): moved $stderr_is_errors default to command() where it's used

9198 05/11/2013 05:20 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: limit_stderr(): do stdout2stderr after limit_stderr to avoid having two similar `can_log ... >/dev/null` commands