mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-09 07:46:59 +00:00
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:
@@ -5,7 +5,7 @@
|
|||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
# Defaults
|
# Defaults
|
||||||
[[ -z "$DOTFILES" ]] && export DOTFILES="$HOME/.dotfiles"
|
[[ -z "${DOTFILES:-}" ]] && export DOTFILES="$HOME/.dotfiles"
|
||||||
DOTFILES_CURRENT_SHELL=$(basename "$SHELL")
|
DOTFILES_CURRENT_SHELL=$(basename "$SHELL")
|
||||||
export DOTFILES_CURRENT_SHELL
|
export DOTFILES_CURRENT_SHELL
|
||||||
|
|
||||||
@@ -76,9 +76,9 @@ x-path-prepend "$DOTFILES/local/bin"
|
|||||||
x-path-prepend "$XDG_BIN_HOME"
|
x-path-prepend "$XDG_BIN_HOME"
|
||||||
|
|
||||||
# Custom completion paths
|
# 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"
|
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
|
if ! declare -f msg > /dev/null; then
|
||||||
# Function to print messages if VERBOSE is enabled
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
: "${DOTFILES:=$HOME/.dotfiles}"
|
: "${DOTFILES:=$HOME/.dotfiles}"
|
||||||
: "${BREWFILE:=$DOTFILES/config/homebrew/Brewfile}"
|
: "${BREWFILE:=$DOTFILES/config/homebrew/Brewfile}"
|
||||||
: "${HOSTFILES:=$DOTFILES/hosts}"
|
: "${HOSTFILES:=$DOTFILES/hosts}"
|
||||||
|
export DOTFILES BREWFILE HOSTFILES
|
||||||
|
|
||||||
SCRIPT=$(basename "$0")
|
SCRIPT=$(basename "$0")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user