about summary refs log tree commit diff
path: root/Functions/VCS_Info/vcs_info_hookadd
blob: 867f7e271197eb6af43cbf715c74ada320e45c14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
## vim:ft=zsh
## Written by Frank Terbeck <ft@bewatermyfriend.org>
## Distributed under the same BSD-ish license as zsh itself.

emulate -L zsh
setopt extendedglob

if (( ${#argv} < 2 )); then
    print 'usage: vcs_info_hookadd <HOOK> <FUNCTION(s)...>'
    return 1
fi

local hook func context
local -a old

hook=$1
shift
context=":vcs_info-static_hooks:${hook}"

zstyle -a "${context}" hooks old
zstyle "${context}" hooks "${old[@]}" "$@"
return $?