1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-30 19:20:53 +02:00

51583: update completion of git attributes

This commit is contained in:
Oliver Kiddle 2023-03-16 22:16:52 +01:00
parent 6386dd94fd
commit 9bd477dce9
2 changed files with 39 additions and 45 deletions

View file

@ -1,5 +1,8 @@
2023-03-16 Oliver Kiddle <opk@zsh.org> 2023-03-16 Oliver Kiddle <opk@zsh.org>
* 51583: Completion/Unix/Command/_git: update completion of
git attributes
* 51582: Completion/Unix/Command/_ssh: openssh 9.3 completion update * 51582: Completion/Unix/Command/_ssh: openssh 9.3 completion update
* 51581: Completion/BSD/Command/_fw_update, * 51581: Completion/BSD/Command/_fw_update,

View file

@ -5866,45 +5866,50 @@ _git-upload-pack () {
(( $+functions[_git-check-attr] )) || (( $+functions[_git-check-attr] )) ||
_git-check-attr () { _git-check-attr () {
local z_opt= local curcontext="$curcontext" z_opt ret=1
local -a state line
local curcontext=$curcontext state line ret=1
declare -A opt_args declare -A opt_args
if (( words[(I)--stdin] )); then if (( words[(I)--stdin] )); then
z_opt='-z[paths are separated with NUL character when reading from stdin]' z_opt='-z[terminate input file list and output records by a NUL character]'
else
z_opt='-z[separate output records with NUL character]'
fi fi
_arguments -C \ _arguments -C $z_opt \
{-a,--all}'[list all attributes that are associated with the specified paths]' \
'--stdin[read file names from stdin instead of from command line]' \ '--stdin[read file names from stdin instead of from command line]' \
'--cached[consider .gitattributes in the index only, ignoring the working tree.]' \ '(--source)--cached[consider .gitattributes in the index only, ignoring the working tree]' \
'-z[terminate input and output records by a NUL character]' \ '(--cached)--source=[specify tree to scan for .gitattributes (useful in bare repo)]:tree object:__git_tree_ishs' \
$z_opt \ - files \
'(-a --all --)'{-a,--all}'[list all attributes that are associated with the specified paths]' \
'(-)--[interpret preceding arguments as attributes and following arguments as path names]' \ '(-)--[interpret preceding arguments as attributes and following arguments as path names]' \
'*:: :->attribute-or-file' && ret=0 '*: :__git_cached_files' \
- attrs \
'*:::attribute:->attributes' && ret=0
case $state in case $state in
(attribute-or-file) attributes)
local -a attributes local -a attributes plain dedup
attributes=(
attributes=(crlf ident filter diff merge) crlf:"line-ending convention (deprecated)"
text:"line-ending normalization"
local only_attributes=1 eol:"line-ending style"
for (( i = 2; i < $#words; i++ )); do working-tree-encoding:"text encoding in working directory"
if (( attributes[(I)$words[i]] == 0 )); then ident:'$Id$ substitution'
only_attributes=0 filter:"filters"
break diff:"textual diff"
fi merge:"merging strategy"
done conflict-marker-size:"length of markers left in the work tree"
whitespace:"control over what diff and apply should consider whitespace errors"
if (( !only_attributes )) || [[ -n ${opt_args[(I)--]} ]]; then export-ignore:"exclude from archive files"
__git_cached_files && ret=0 export-subst:"expand placeholders when adding to an archive"
else delta:"don't attempt compression of blobs"
_alternative \ encoding:"character encoding that should be used by GUI tools"
'attributes::__git_attributes' \ )
'files::__git_cached_files' && ret=0 plain=( ${attributes%%:*} )
fi dedup=( "${(@)words[1,CURRENT-1]}" )
(( ! ${#dedup:|plain} )) && _describe -t git-attributes \
attribute attributes -F dedup && ret=0
;; ;;
esac esac
@ -6584,20 +6589,6 @@ __git_compression_levels () {
'9:maximum compression' '9:maximum compression'
} }
(( $+functions[__git_attributes] )) ||
__git_attributes () {
local -a attributes
attributes=(
'crlf:line-ending convention'
'ident:ident substitution'
'filter:filters'
'diff:textual diff'
'merge:merging strategy')
_describe -t attributes attribute attributes $*
}
(( $+functions[__git_daemon_service] )) || (( $+functions[__git_daemon_service] )) ||
__git_daemon_service () { __git_daemon_service () {
local -a services local -a services