dotfiles/home/dot-local/lib/bash/init.sh

30 lines
896 B
Bash
Raw Normal View History

2022-02-03 18:33:04 +00:00
#!/usr/bin/env bash
# Shell options which will be like a strict mode
set -${DEBUG:+x}euo pipefail
# This script should be sourced before any of
# the other scripts in this repo. Other scripts
# make use of ${BASH_LIB_DIR} to find each other.
# Get the relative path to the repo root
# shellcheck disable=SC2086
BASH_LIB_DIR_RELATIVE="$(dirname ${BASH_SOURCE[0]})"
# Must be set in order to load the filehandling
# module. Will be updated when abs_path is available.
BASH_LIB_DIR="${BASH_LIB_DIR_RELATIVE}"
for name in common; do
source "${BASH_LIB_DIR_RELATIVE}/${name}/${name}.sh"
done
# Filter functions and re export only bash-lib functions to subshells
eval "$(declare -F | sed -e 's/-f /-fx /' | grep 'x bl_')"
# Export the absolute path
# shellcheck disable=SC2086
BASH_LIB_DIR="$(realpath ${BASH_LIB_DIR_RELATIVE})"
export BASH_LIB_DIR
MODULEPATH="${MODULEPATH:+"${MODULEPATH}:"}"