scwrypts/zsh/utils
yage 96992e9344 v2.3.0
=====================================================================

--- New Scripts --------------------------

zsh )
  latex + latex template engine
   - latex/build-pdf
   - latex/cleanup
   - latex/create-new
   - latex/get-pdf
   - latex/open-pdf

  beta SQL script -- got tired of floating this; works, but only OK
   - db/run-sql/postgres

--- Changes ------------------------------

- Added 'math', 'basic', and 'times-new-roman' templates to latex
- Added 'readlink' to list of required coreutils
- Added __INPUT to read into a variable with prompt (zsh/utils/io)
- Added $EXECUTION_DIR to interact with the user's working directory

--- Bug Fixes ----------------------------

- subscwrypts no longer force stdout/stderr to tty
2022-08-09 21:51:31 -06:00
..
colors.zsh v2.0.2 2022-07-01 22:17:23 -06:00
credits.zsh v2.0.0 2022-07-01 22:17:15 -06:00
dependencies.zsh v2.3.0 2022-08-09 21:51:31 -06:00
environment.zsh v2.0.0 2022-07-01 22:17:15 -06:00
io.zsh v2.3.0 2022-08-09 21:51:31 -06:00
os.zsh v1.0.0 2022-07-01 22:16:50 -06:00
README.md v2.0.2 2022-07-01 22:17:23 -06:00
utils.module.zsh v2.0.2 2022-07-01 22:17:23 -06:00

ZSH Utilities

A shell-scripting utilities module made for ZSH. This module is definitely a major component of Scwrypts, but is also standalone and can be sourced by any ZSH script to utilize (almost) all of the features.

Usage

Import utils.module.zsh to activate all of the features. Doing so will also check for path dependencies and required environment variables (see Dependencies and Environment below).

#!/bin/zsh
source ./path/to/utils.plugin.zsh
__SUCCESS 'ZSH utilities online!'

Checkout io and os for available simple functions.

Dependencies

Ensures dependent programs are available for execution. Specify a simple name to check the current PATH, or give a fully-qualified path for arbitrary dependency inclusion.

Include a dependency by adding to the _DEPENDENCIES array. Always using += makes your dependencies extensible to other scripts :)

If any dependencies are missing, source utils.module.zsh will return an error code and count the number of missing dependencies in the variable DEP_ERROR_COUNT.

#!/bin/zsh
_DEPENDENCIES+=(
	path-executable-1
	path-executable-2
	/path/to/arbitrary/program
)
source ./path/to/utils.plugin.zsh
echo "missing $DEP_ERROR required dependencies"

Environment

Similar to Dependencies, environment.zsh ensures a list of environment variables are set to non-empty values.

Include an environment variable by adding to the _REQUIRED_ENV array. Something something use += here too ;)

If any environment variables are missing, source utils.module.zsh will return an error code and count the number of missing variables in ENV_ERROR_COUNT.

Missing environment variables will be added to the environment template (exclusive to Scwrypts).

#!/bin/zsh
_REQUIRED_ENV+=(
	AWS_PROFILE
	AWS_REGION
)
source ./path/to/utils.plugin.zsh
echo "missing $ENV_ERROR_COUNT required environment variables"