Improve error prompt

Former-commit-id: e002b469d6
This commit is contained in:
Wenxuan 2017-11-25 11:12:27 +08:00
parent 736caa2975
commit bb135ea0fb

View file

@ -20,9 +20,12 @@ wfxr::fzf() {
unalias glo gd ga gi &>/dev/null
inside_work_tree() {
git rev-parse --is-inside-work-tree >/dev/null
}
# git commit browser
glo() {
git rev-parse --is-inside-work-tree &>/dev/null || return 1
inside_work_tree || return 1
# diff is fancy with diff-so-fancy!
local cmd="echo {} |grep -o '[a-f0-9]\{7\}' |head -1 |xargs -I% git show --color=always % $emojify $fancy"
eval "git log --graph --color=always --format='%C(auto)%h%d %s %C(black)%C(bold)%cr' $@ $emojify" \
@ -33,6 +36,7 @@ glo() {
}
# git diff brower
gd() {
inside_work_tree || return 1
local cmd="git diff --color=always -- {} $emojify $fancy"
git ls-files --modified \
|wfxr::fzf -e -0 --bind="enter:execute($cmd |less -R)" \
@ -41,6 +45,7 @@ gd() {
}
# git add selector
ga() {
inside_work_tree || return 1
original=$(git config color.status)
git config color.status always
IFS=$'\n'