diff --git a/bin/git-forgit b/bin/git-forgit new file mode 100755 index 0000000..7e7a3d3 --- /dev/null +++ b/bin/git-forgit @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -e + +source "$FORGIT_INSTALL_DIR/forgit.plugin.zsh" + +cmd="$1" +shift +forgit::${cmd/-/::} "$@" diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index f63b90d..de55079 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -333,3 +333,18 @@ if [[ -z "$FORGIT_NO_ALIASES" ]]; then alias "${forgit_rebase:-grb}"='forgit::rebase' alias "${forgit_fixup:-gfu}"='forgit::fixup' fi + +if [[ -n "$FORGIT_STANDALONE" ]]; then + if [[ -n "$ZSH_VERSION" ]]; then + FORGIT_INSTALL_DIR="$( dirname -- "$0")" + elif [[ -n "$BASH_VERSION" ]]; then + FORGIT_INSTALL_DIR="$(dirname -- "${BASH_SOURCE[0]}")" + else + forgit::warn "Shell not supported for FORGIT_STANDLONE (only zsh and bash)" + fi + + if [[ -n "$FORGIT_INSTALL_DIR" ]]; then + export FORGIT_INSTALL_DIR + fi +fi +