Add gpgwkd function for gpg key fetches
[zsh.git] / .zsh / external / zaw / sources / git-log.zsh
1
2 function zaw-src-git-log() {
3 git rev-parse --git-dir >/dev/null 2>&1
4 if [[ $? == 0 ]]; then
5 local desc="$(git log --all --graph --decorate --oneline --no-color)"
6
7 : ${(A)cand_descriptions::=${(f)desc}}
8 : ${(A)candidates::=${(f)desc}}
9 fi
10 actions=(zaw-src-git-log-insert \
11 zaw-src-git-log-reset \
12 zaw-src-git-log-reset-hard \
13 zaw-src-git-log-cherry-pick \
14 zaw-src-git-log-create-branch \
15 zaw-src-git-log-revert)
16 act_descriptions=("insert" \
17 "reset" \
18 "reset --hard" \
19 "cherry-pick" \
20 "create new branch from this hash value" \
21 "revert")
22 options=()
23 }
24
25 function _zaw-src-git-log-strip(){
26 echo $1 | sed -e 's/^[*|/\\ ]* \([a-f0-9]*\) .*/\1/'
27 }
28
29 function zaw-src-git-log-insert(){
30 local hash_val=$(_zaw-src-git-log-strip $1)
31 zaw-callback-append-to-buffer $hash_val
32 }
33
34 function zaw-src-git-log-reset(){
35 local hash_val=$(_zaw-src-git-log-strip $1)
36 BUFFER="git reset $hash_val"
37 zle accept-line
38 }
39
40 function zaw-src-git-log-reset-hard(){
41 local hash_val=$(_zaw-src-git-log-strip $1)
42 BUFFER="git reset --hard $hash_val"
43 zle accept-line
44 }
45
46 function zaw-src-git-log-cherry-pick(){
47 local hash_val=$(_zaw-src-git-log-strip $1)
48 BUFFER="git cherry-pick $hash_val"
49 zle accept-line
50 }
51
52 function zaw-src-git-log-create-branch(){
53 local hash_val=$(_zaw-src-git-log-strip $1)
54 LBUFFER="git checkout -b "
55 RBUFFER=" $hash_val"
56 }
57
58 function zaw-src-git-log-revert(){
59 local hash_val=$(_zaw-src-git-log-strip $1)
60 BUFFER="git revert $hash_val"
61 zle accept-line
62 }
63
64 zaw-register-src -n git-log zaw-src-git-log