mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-21 19:31:50 +02:00
52141: Add trailer token completion for git commit --trailer
Via 842587016d in the git project there has been support for git commit trailer tokens for the bash completion system. This commit adds similar support to zsh. It includes additional hardening of the regexp and allows for tokens which include a '.'. This can be found in git via 9a0ec17606.
This commit is contained in:
parent
d3394f3593
commit
fa17566b65
@ -1,5 +1,8 @@
|
||||
2023-09-20 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* Wesley Schwengle: 52141: Completion/Unix/Command/_git: add trailer
|
||||
token completion for git commit --trailer
|
||||
|
||||
* 52163: Completion/Unix/Command/_zfs: completion update for
|
||||
OpenZFS 2.2
|
||||
|
||||
|
@ -717,7 +717,7 @@ _git-commit () {
|
||||
{-p,--patch}'[use the interactive patch selection interface to chose which changes to commit]' \
|
||||
'(--reset-author)--author[override the author name used in the commit]:author name' \
|
||||
'--date=[override the author date used in the commit]:date' \
|
||||
'*--trailer=[add custom trailer(s)]:trailer' \
|
||||
'*--trailer=[add custom trailer(s)]:trailer:__git_trailers_tokens' \
|
||||
'(-s --signoff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \
|
||||
'(-n --no-verify)'{-n,--no-verify}'[bypass pre-commit and commit-msg hooks]' \
|
||||
'--allow-empty[allow recording an empty commit]' \
|
||||
@ -7413,6 +7413,19 @@ __git_deleted_files () {
|
||||
__git_files --deleted deleted-files 'deleted file' $*
|
||||
}
|
||||
|
||||
(( $+functions[__git_trailers_tokens] )) ||
|
||||
__git_trailers_tokens() {
|
||||
declare -a trailers
|
||||
local i
|
||||
|
||||
local -a gtrailers=( $(_call_program trailers git config --name-only --get-regexp '^trailer\..*\.key$') )
|
||||
for i in $gtrailers; do
|
||||
i=( ${${(@s:.:)i}[2,-2]} )
|
||||
trailers+=( ${(j|.|)i} )
|
||||
done
|
||||
_wanted trailers expl "trailer" compadd -a trailers
|
||||
}
|
||||
|
||||
(( $+functions[__git_modified_files] )) ||
|
||||
__git_modified_files () {
|
||||
__git_files --modified modified-files 'modified file' $*
|
||||
|
Loading…
Reference in New Issue
Block a user