Add documentation and align it with actual functionality

Former-commit-id: 827d1e56a3
This commit is contained in:
Doron Behar 2019-05-29 09:32:17 +03:00
parent e766a62ed5
commit e15849c990
2 changed files with 13 additions and 2 deletions

View file

@ -114,6 +114,17 @@ FORGIT_FZF_DEFAULT_OPTS="
--height '80%'
"
```
You can also customize options fzf will use for each command individually:
- `ga`: `FORGIT_ADD_FZF_OPTS`
- `glo`: `FORGIT_LOG_FZF_OPTS`
- `gi`: `FORGIT_IGNORE_FZF_OPTS`
- `gd`: `FORGIT_DIFF_FZF_OPTS`
- `gcf`: `FORGIT_CHECKOUT_FZF_OPTS`
- `gss`: `FORGIT_STASH_FZF_OPTS`
- `gclean`: `FORGIT_CLEAN_FZF_OPTS`
## Optional
- [`diff-so-fancy`](https://github.com/so-fancy/diff-so-fancy): Improve the `git diff` output.

View file

@ -62,7 +62,7 @@ forgit::restore() {
local cmd files
files="$(git ls-files --modified "$(git rev-parse --show-toplevel)"|
forgit::fzf -m -0 --preview="$preview_cmd" |
"$FORGIT_RESTORE_FZF_OPTS")"
"$FORGIT_CHECKOUT_FZF_OPTS")"
[[ -n "$files" ]] && echo "$files" |xargs -I{} git checkout {} && git status --short && return
echo 'Nothing to restore.'
}
@ -83,7 +83,7 @@ forgit::clean() {
forgit::inside_work_tree || return 1
local files
# Note: Postfix '/' in directory path should be removed. Otherwise the directory itself will not be removed.
files=$(git clean -xdfn "$@"| awk '{print $3}'| forgit::fzf -m -0 |sed 's#/$##')
files=$(git clean -xdfn "$@"| awk '{print $3}'| forgit::fzf -m -0 "$FORGIT_CLEAN_FZF_OPTS" |sed 's#/$##')
[[ -n "$files" ]] && echo "$files" |xargs -I{} git clean -xdf {}
echo 'Nothing to clean.'
}