Skip to content

Commit

Permalink
zsh plugin: exit with an error if bin path cannot be determined
Browse files Browse the repository at this point in the history
  • Loading branch information
carlfriedrich committed Nov 14, 2022
1 parent 58882fd commit b2d2413
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions forgit.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# MIT (c) Wenxuan Zhang

forgit::warn() { printf "%b[Warn]%b %s\n" '\e[0;33m' '\e[0m' "$@" >&2; }
forgit::error() { printf "%b[Error]%b %s\n" '\e[0;31m' '\e[0m' "$@" >&2; return 1; }

# set installation path
if [[ -n "$ZSH_VERSION" ]]; then
Expand All @@ -13,12 +13,11 @@ if [[ -n "$ZSH_VERSION" ]]; then
elif [[ -n "$BASH_VERSION" ]]; then
FORGIT_INSTALL_DIR="$(dirname -- "${BASH_SOURCE[0]}")"
else
forgit::warn "Only zsh and bash are fully supported"
fi
if [[ -n "$FORGIT_INSTALL_DIR" ]]; then
export FORGIT_INSTALL_DIR
forgit::error "Only zsh and bash are supported"
fi
export FORGIT_INSTALL_DIR

# register shell functions
forgit::log() {
"$FORGIT_INSTALL_DIR/bin/git-forgit" log "$@"
}
Expand Down

0 comments on commit b2d2413

Please sign in to comment.