mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-03 10:21:46 +02:00
Frank Terbeck: 25624: clean up git alias parsing.
This commit is contained in:
parent
db31a13ecd
commit
07462f8303
2 changed files with 11 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
2008-09-07 Clint Adams <clint@zsh.org>
|
||||
|
||||
* Frank Terbeck: 25624: Completion/Unix/Command/_git: clean up git
|
||||
alias parsing.
|
||||
|
||||
2008-09-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 25627: Doc/Zsh/params.yo, Src/exec.c, Src/params.c,
|
||||
|
|
|
@ -4272,11 +4272,12 @@ local curcontext=$curcontext ret=1
|
|||
# fun with $words[] and $CURRENT to enable completion for args
|
||||
# to git aliases (eg. git co <TAB>)
|
||||
local -A git_aliases
|
||||
# TODO: filling git_aliases like this is ugly. I didn't get it working elegantly.
|
||||
local oifs=$IFS
|
||||
IFS=$'\0'
|
||||
git_aliases=(${=${(0)${(@)${${${(f)"$(git config --get-regexp alias.\*)"}/(#s)alias./}/ /$'\0'}}}})
|
||||
IFS=$oifs ; unset oifs
|
||||
local -a git_aliases__
|
||||
git_aliases__=(${(f)${${${(f)"$(_call_program alias_expansion git config --get-regexp '\^alias\.')"}#alias.}/ /$'\n'}/(#e)/$'\n'})
|
||||
if (( ( ${#git_aliases__} % 2 ) == 0 )) ; then
|
||||
git_aliases=(${git_aliases__})
|
||||
fi
|
||||
unset git_aliases__
|
||||
|
||||
if (( CURRENT >= 3 )) && [[ -n ${git_aliases[$words[2]]} ]] ; then
|
||||
local -a tmpwords expalias
|
||||
|
|
Loading…
Reference in a new issue