env: add error handling for missing docs repo
This commit is contained in:
parent
3287af5104
commit
57a85f47da
1 changed files with 9 additions and 3 deletions
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
export SHELL_CONFIG_DIR="${SHELL_CONFIG_DIR:-"${XDG_CONFIG_HOME:-"$HOME/.config"}/shell"}"
|
export SHELL_CONFIG_DIR="${SHELL_CONFIG_DIR:-"${XDG_CONFIG_HOME:-"$HOME/.config"}/shell"}"
|
||||||
if ! [ -d "$SHELL_CONFIG_DIR" ]; then
|
if ! [ -d "$SHELL_CONFIG_DIR" ]; then
|
||||||
echo "FATAL ERROR: \$SHELL_CONFIG_DIR is not set to a real directory: $SHELL_CONFIG_DIR"
|
echo "FATAL ERROR: \$SHELL_CONFIG_DIR is not set to a real directory: $SHELL_CONFIG_DIR" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Intelligently set $EDITOR
|
# Intelligently set $EDITOR
|
||||||
|
@ -33,8 +33,14 @@ export ZINIT_HOME_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/zinit"
|
||||||
|
|
||||||
|
|
||||||
# Set documents directory (auto set to the repo the file ~/todo points to is in)
|
# Set documents directory (auto set to the repo the file ~/todo points to is in)
|
||||||
|
if [ -h ~/todo ]; then
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
[ -h ~/todo ] && export DOCS_DIR="$(git -C "$(dirname "$(realpath ~/todo)" 2>&1)" rev-parse --show-toplevel | head -1)" || DOCS_DIR="$HOME/Documents/docs/"
|
export DOCS_DIR="$(git -C "$(dirname "$(realpath ~/todo)" 2>&1)" rev-parse --show-toplevel | head -1)"
|
||||||
|
elif [ -d "$HOME/Documents/docs" ]; then
|
||||||
|
export DOCS_DIR="$HOME/Documents/docs/"
|
||||||
|
else
|
||||||
|
echo "Error: couldn't find the documents repo" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
## Working directory save settings (see things at bottom of zshrc)
|
## Working directory save settings (see things at bottom of zshrc)
|
||||||
WORKING_DIR_SAVE_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/last-working-dir"
|
WORKING_DIR_SAVE_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/last-working-dir"
|
||||||
|
|
Loading…
Add table
Reference in a new issue