mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Support the browsing of other Git remotes/branches.
This commit is contained in:
parent
5bb9a3e4b5
commit
66c4aae59e
3 changed files with 53 additions and 4 deletions
29
plugins/git/completions/_git-hub
Normal file
29
plugins/git/completions/_git-hub
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#compdef git-hub
|
||||
#autoload
|
||||
|
||||
local state remotes remote branches ret=1
|
||||
|
||||
_arguments -C -s -S \
|
||||
'1::args:->remote' \
|
||||
'2::args:->branch' && ret=0
|
||||
|
||||
case "$state" in
|
||||
(remote)
|
||||
remotes=($(
|
||||
git config -l \
|
||||
| grep 'remote\.[^.]*\.url' \
|
||||
| cut -d'.' -f2))
|
||||
_describe -t branch 'remotes' remotes && ret=0
|
||||
;;
|
||||
(branch)
|
||||
remote="$words[(($CURRENT - 1))]"
|
||||
branches=($(
|
||||
git branch -a \
|
||||
| grep "remotes/${remote}" \
|
||||
| sed -e 's/[ \*]*//g' -e "s:remotes/${remote}/::g"
|
||||
))
|
||||
_describe -t branch 'branches' branches && ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return $ret
|
||||
Loading…
Add table
Add a link
Reference in a new issue