Class: WO::Hook::Zsh

Inherits:
Object
  • Object
show all
Defined in:
lib/wo/hook/zsh.rb

Instance Method Summary collapse

Instance Method Details

#hookObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/wo/hook/zsh.rb', line 4

def hook
  %(
_wo_hook() {
  repo_path=`git rev-parse --show-toplevel 2>&1`

  if [[ "$?" == 0 ]] ; then
    if [[ ${WO_FILE_PATH} != "" ]] ; then
wo_file=`cat ${WO_FILE_PATH}/.wo 2>&1`
    else
wo_file=`cat ${repo_path}/.wo 2>&1`
    fi

    if [[ "$?" == 0 ]] ; then
repo=`basename ${repo_path}`
branch=`git rev-parse --abbrev-ref HEAD`
user_name=`git config user.name`

wo doing ${repo} ${branch} ${user_name}
    fi
  fi
}

_wo_hook_background() {
  (_wo_hook &)
}

typeset -ag precmd_functions
if [[ -z $precmd_functions[(r)_wo_hook_background] ]]; then
  precmd_functions+=_wo_hook_background;
fi
  )
end