fix(shell): harden shared.sh and dfm for set -euo pipefail

Use ${VAR:-} defaults in shared.sh to prevent set -u failures on
unset variables (DOTFILES, ZSH_CUSTOM_COMPLETION_PATH, FPATH).
Export DOTFILES/BREWFILE/HOSTFILES in dfm so sourced scripts see them.
This commit is contained in:
2026-02-08 01:12:39 +02:00
parent 785a8e8eb7
commit a18c16b0b9
2 changed files with 4 additions and 3 deletions

View File

@@ -5,7 +5,7 @@
# shellcheck shell=bash
# Defaults
[[ -z "$DOTFILES" ]] && export DOTFILES="$HOME/.dotfiles"
[[ -z "${DOTFILES:-}" ]] && export DOTFILES="$HOME/.dotfiles"
DOTFILES_CURRENT_SHELL=$(basename "$SHELL")
export DOTFILES_CURRENT_SHELL
@@ -76,9 +76,9 @@ x-path-prepend "$DOTFILES/local/bin"
x-path-prepend "$XDG_BIN_HOME"
# Custom completion paths
[[ -z "$ZSH_CUSTOM_COMPLETION_PATH" ]] && export ZSH_CUSTOM_COMPLETION_PATH="$XDG_CONFIG_HOME/zsh/completion"
[[ -z "${ZSH_CUSTOM_COMPLETION_PATH:-}" ]] && export ZSH_CUSTOM_COMPLETION_PATH="$XDG_CONFIG_HOME/zsh/completion"
x-dc "$ZSH_CUSTOM_COMPLETION_PATH"
export FPATH="$ZSH_CUSTOM_COMPLETION_PATH:$FPATH"
export FPATH="$ZSH_CUSTOM_COMPLETION_PATH:${FPATH:-}"
if ! declare -f msg > /dev/null; then
# Function to print messages if VERBOSE is enabled