diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-10-23 22:11:16 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-10-23 22:11:16 +0200 |
commit | ddb88acf45fca2aad858c594c8639517789a06ee (patch) | |
tree | 915554dec2fbc9233dd05913e9de3b7a224740a6 /etc/completions | |
parent | e11b8be3b52a1646d2b4e83712dee135c5d1c2f4 (diff) |
Added git-hook function
Diffstat (limited to 'etc/completions')
-rw-r--r-- | etc/completions/_git-hook | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/etc/completions/_git-hook b/etc/completions/_git-hook new file mode 100644 index 0000000..b57c7a1 --- /dev/null +++ b/etc/completions/_git-hook @@ -0,0 +1,26 @@ +#compdef git-hook + +typeset hook_dir expl + +if [[ -n $GIT_DIR && -d $GIT_DIR ]] { + hook_dir=$GIT_DIR/hooks +} elif [[ -d hooks ]] { + hook_dir=$PWD/hooks +} elif [[ -d .git/hooks ]] { + hook_dir=$PWD/.git/hooks +} elif [[ $PWD == */hooks ]] { + hook_dir=$PWD +} + +if (( CURRENT == 2 )) { + _wanted ation expl 'action' \ + compadd list enable disable +} elif (( CURRENT == 3 )) { + if [[ ${words[2]} == 'enable' ]] { + _wanted hook expl 'git hook' \ + _path_files -W $hook_dir -g '*(^x)' + } elif [[ ${words[2]} == 'disable' ]] { + _wanted hook expl 'git hook' \ + _path_files -W $hook_dir -g '*(x)' + } +} |