env: add check to see if git exists
This commit is contained in:
parent
e2d2a29146
commit
6df60bdbec
1 changed files with 2 additions and 2 deletions
|
@ -33,13 +33,13 @@ 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
|
if [ -h ~/todo ] && command -v git > /dev/null; then
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
export DOCS_DIR="$(git -C "$(dirname "$(realpath ~/todo)" 2>&1)" rev-parse --show-toplevel | head -1)"
|
export DOCS_DIR="$(git -C "$(dirname "$(realpath ~/todo)" 2>&1)" rev-parse --show-toplevel | head -1)"
|
||||||
elif [ -d "$HOME/Documents/docs" ]; then
|
elif [ -d "$HOME/Documents/docs" ]; then
|
||||||
export DOCS_DIR="$HOME/Documents/docs/"
|
export DOCS_DIR="$HOME/Documents/docs/"
|
||||||
else
|
else
|
||||||
echo "Error: couldn't find the documents repo" >&2
|
echo "Error: couldn't find the documents repo" > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Working directory save settings (see things at bottom of zshrc)
|
## Working directory save settings (see things at bottom of zshrc)
|
||||||
|
|
Loading…
Add table
Reference in a new issue