From 4f4ab08339c721ab82c18c4f9a487437016c797d Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Mon, 19 Aug 2013 19:02:28 -0700 Subject: [PATCH] Added auto completion for git-note --- plugins/git-note/git-note.plugin.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 plugins/git-note/git-note.plugin.zsh diff --git a/plugins/git-note/git-note.plugin.zsh b/plugins/git-note/git-note.plugin.zsh new file mode 100644 index 000000000..a48c23366 --- /dev/null +++ b/plugins/git-note/git-note.plugin.zsh @@ -0,0 +1,18 @@ +#compdef git +__git_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +_git-note() { + _arguments '-b :branch-name:__git_branch_names [branch to attach note to]' \ + '-l[list all branches with notes]' \ + '-v[also show branches without notes]' +} + +zstyle ':completion:*:*:git:*' user-commands \ + note:'add a note to branch' \ +