From db619daa6eb487c9940166772a2141b1b78488fa Mon Sep 17 00:00:00 2001 From: Christopher Apple Date: Tue, 5 Nov 2019 08:54:29 -0700 Subject: [PATCH 1/2] Fixed readme and added fzf check to zsh to be the same as fish version Former-commit-id: 4ab5a2daae760bb723d37516d4e806ec987c5661 --- README.md | 14 +++++++++++--- forgit.plugin.zsh | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7703899..159f7b0 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,19 @@ ### Try Online -Run the following command in your shell to try `forgit` without installing(for both `bash` and `zsh`): +Run the following command in your shell to try `forgit` without installing: + +##### Bash and ZSH + ``` bash source <(curl -Ss https://raw.githubusercontent.com/wfxr/forgit/master/forgit.plugin.zsh) ``` +##### Fish +``` fish +source (curl -Ss https://raw.githubusercontent.com/wfxr/forgit/master/forgit.plugin.fish | psub) +``` +### Installation using a ZSH Plugin manager ### [Zplug](https://github.com/zplug/zplug) ``` zsh zplug 'wfxr/forgit' @@ -30,9 +38,9 @@ zgen load 'wfxr/forgit' antigen bundle 'wfxr/forgit' ``` -### Manually +### Manual Installation -Download and source `forgit.plugin.zsh` or `forgit.plugin.sh` in your shell config. +Download and source `forgit.plugin.zsh`, `forgit.plugin.sh`, or `forgit.plugin.fish` in your shell config. ## Commands diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index 40ae1eb..0b9e66e 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -1,4 +1,5 @@ # MIT (c) Wenxuan Zhang +hash fzf > /dev/null 2>&1 || {echo "FZF not found and is requried for forgit" && return 1} forgit::warn() { printf "%b[Warn]%b %s\n" '\e[0;33m' '\e[0m' "$@" >&2; } forgit::info() { printf "%b[Info]%b %s\n" '\e[0;32m' '\e[0m' "$@" >&2; } From ad76f6259c2eaec5e067baf37e7260f8c729dfbf Mon Sep 17 00:00:00 2001 From: Christopher Apple Date: Tue, 5 Nov 2019 20:06:45 -0700 Subject: [PATCH 2/2] Moved warning for no fzf to forgit::warn Former-commit-id: 325e98cd03c71d7e280b7259ff7793cec0afd726 --- forgit.plugin.fish | 10 +++++----- forgit.plugin.zsh | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/forgit.plugin.fish b/forgit.plugin.fish index db36a0f..9bbc2aa 100755 --- a/forgit.plugin.fish +++ b/forgit.plugin.fish @@ -1,11 +1,6 @@ #!/usr/local/bin/fish # MIT (c) Chris Apple -if not hash fzf > /dev/null 2>&1 - echo "FZF not found and is requried for forgit" - exit 1 -end - function forgit::warn printf "%b[Warn]%b %s\n" '\e[0;33m' '\e[0m' "$argv" >&2; end @@ -18,6 +13,11 @@ function forgit::inside_work_tree git rev-parse --is-inside-work-tree >/dev/null; end +if not hash fzf > /dev/null 2>&1 + forgit::warn "FZF not found and is requried for forgit" + exit 1 +end + # https://github.com/so-fancy/diff-so-fancy hash diff-so-fancy >/dev/null 2>&1 && set forgit_fancy '|diff-so-fancy' # https://github.com/wfxr/emoji-cli diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index 0b9e66e..6b00215 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -1,10 +1,10 @@ # MIT (c) Wenxuan Zhang -hash fzf > /dev/null 2>&1 || {echo "FZF not found and is requried for forgit" && return 1} - forgit::warn() { printf "%b[Warn]%b %s\n" '\e[0;33m' '\e[0m' "$@" >&2; } forgit::info() { printf "%b[Info]%b %s\n" '\e[0;32m' '\e[0m' "$@" >&2; } forgit::inside_work_tree() { git rev-parse --is-inside-work-tree >/dev/null; } +hash fzf &>/dev/null || {forgit::warn "FZF not found and is requried for forgit" && return 1} + # https://github.com/so-fancy/diff-so-fancy hash diff-so-fancy &>/dev/null && forgit_fancy='|diff-so-fancy' # https://github.com/wfxr/emoji-cli