omnixient/modules/dev-env/scripts/lib.sh
2026-06-28 09:59:05 +02:00

24 lines
1 KiB
Bash

# dev-env — shared config-loader library.
#
# Installed at /etc/dev-env/lib.sh and sourced by the shell-function
# modules (nav / worktree / pr-helpers / regtest). Holds the runtime
# config loader that was previously copy-pasted into each module.
#
# Side-effect-free at top level (function definitions only): it is
# sourced into interactive shells and may be re-sourced freely, so it
# must stay idempotent and must not clobber the user's environment.
# Colours deliberately live in lib-colors.sh (sourced only by the
# standalone bins) so they don't leak into interactive shells.
# Load the rendered runtime config (DEV_ROOT, REPOS_DIR, deploy targets,
# …) into the current shell. Safe to call repeatedly.
_devenv_source_config() {
if [[ -r /etc/dev-env/config.sh ]]; then
# shellcheck disable=SC1091
source /etc/dev-env/config.sh
fi
}
# Default loader used by the navigation / worktree / PR modules.
# regtest.sh overrides this to layer on its own path defaults.
_devenv_load_config() { _devenv_source_config; }