1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2025-07-04 23:49:25 +00:00

Add support for browsing GitHub tags

This commit is contained in:
Sorin Ionescu
2012-09-24 17:57:48 -04:00
parent 224dc2eaff
commit e43f2b2659
2 changed files with 39 additions and 22 deletions

View File

@ -8,11 +8,11 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
local state remotes remote branches files ret=1
local state remotes remote branches_or_tags branches tags files ret=1
_arguments -C -s -S \
'1::args:->remote' \
'2::args:->branch' \
'2::args:->branch-or-tag' \
'3::args:->file' && ret=0
case "$state" in
@ -23,13 +23,18 @@ case "$state" in
))
_describe -t branch 'remotes' remotes && ret=0
;;
(branch)
(branch-or-tag)
remote="$words[(($CURRENT - 1))]"
branches=($(
git ls-remote --heads "$remote" \
| awk '{gsub(/refs\/heads\//, "", $2)} ; {print $2}'
branches_or_tags=($(
git ls-remote --heads --tags "$remote" | awk '{print $2}'
))
branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/})
tags=(${${(M)branches_or_tags[@]##refs/tags/?##}##refs/tags/})
_describe -t branch 'branches' branches && ret=0
_describe -t tag 'tags' tags && ret=0
;;
(file)
files=(${(0)"$(_call_program files git ls-files -z --exclude-standard 2>/dev/null)"})