1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-18 15:21:16 +02:00

23595: merge in git archive completion from Nikolai Weibull's repository.

This commit is contained in:
Clint Adams 2007-06-24 15:35:39 +00:00
parent be3ada1cc7
commit cc2867746a
2 changed files with 55 additions and 1 deletions

View file

@ -1,5 +1,8 @@
2007-06-24 Clint Adams <clint@zsh.org>
* 23595: Completion/Unix/Command/_git: merge in git archive
completion from Nikolai Weibull's repository.
* 23594: Completion/Unix/Command/_git: merge in git grep
completion from Nikolai Weibull's repository.

View file

@ -1,4 +1,4 @@
#compdef git git-annotate git-apply git-checkout-index git-commit-tree git-hash-object git-index-pack git-init-db git-merge-index git-mktag git-pack-objects git-prune-packed git-read-tree git-unpack-objects git-update-index git-write-tree git-cat-file git-diff-index git-diff-files git-diff-stages git-diff-tree git-fsck-objects git-ls-files git-ls-tree git-merge-base git-name-rev git-rev-list git-show-index git-tar-tree git-unpack-file git-var git-verify-pack git-clone-pack git-fetch-pack git-http-fetch git-local-fetch git-peek-remote git-receive-pack git-send-pack git-ssh-fetch git-ssh-upload git-update-server-info git-upload-pack git-add git-am git-applymbox git-bisect git-branch git-checkout git-cherry-pick git-clone git-commit git-diff git-fetch git-format-patch git-grep git-log git-ls-remote git-merge git-mv git-octopus git-pull git-push git-rebase git-repack git-reset git-resolve git-revert git-shortlog git-show-branch git-status git-verify-tag git-whatchanged git-applypatch git-archimport git-convert-objects git-cvsimport git-lost-found git-merge-one-file git-prune git-relink git-svnimport git-symbolic-ref git-tag git-update-ref git-check-ref-format git-cherry git-count-objects git-daemon git-get-tar-commit-id git-mailinfo git-mailsplit git-patch-id git-request-pull git-send-email git-stripspace
#compdef git git-annotate git-apply git-checkout-index git-commit-tree git-hash-object git-index-pack git-init-db git-merge-index git-mktag git-pack-objects git-prune-packed git-read-tree git-unpack-objects git-update-index git-write-tree git-cat-file git-diff-index git-diff-files git-diff-stages git-diff-tree git-fsck-objects git-ls-files git-ls-tree git-merge-base git-name-rev git-rev-list git-show-index git-tar-tree git-unpack-file git-var git-verify-pack git-clone-pack git-fetch-pack git-http-fetch git-local-fetch git-peek-remote git-receive-pack git-send-pack git-ssh-fetch git-ssh-upload git-update-server-info git-upload-pack git-add git-am git-applymbox git-bisect git-branch git-checkout git-cherry-pick git-clone git-commit git-diff git-fetch git-format-patch git-grep git-log git-ls-remote git-merge git-mv git-octopus git-pull git-push git-rebase git-repack git-reset git-resolve git-revert git-shortlog git-show-branch git-status git-verify-tag git-whatchanged git-applypatch git-archimport git-archive git-convert-objects git-cvsimport git-lost-found git-merge-one-file git-prune git-relink git-svnimport git-symbolic-ref git-tag git-update-ref git-check-ref-format git-cherry git-count-objects git-daemon git-get-tar-commit-id git-mailinfo git-mailsplit git-patch-id git-request-pull git-send-email git-stripspace
# Commands not completed:
# git-sh-setup
@ -87,6 +87,7 @@ _git_commands () {
'applymbox:apply patches from a mailbox'
'applypatch:apply one patch extracted from an e-mail'
'archimport:import an Arch repository into git'
'archive:create an archive of files from a named tree'
'bisect:find the change that introduced a bug'
'branch:create and show branches'
'cat-file:provide content or type information for repository objects'
@ -698,6 +699,46 @@ _git-applymbox () {
'::signoff file:__git_signoff_file' && ret=0
}
_git-archive () {
local curcontext=$curcontext state line
declare -A opt_args
declare -a backend_args
if (( words[(I)--format=*] > 0 && words[(I)--format=*] < CURRENT )); then
case ${words[$words[(I)--format=*]]#--format=} in
(zip)
backend_args=(
'-0[do not deflate files]'
'-1[minimum compression]'
'-2[a little more compression]'
'-3[slightly more compression]'
'-4[a bit more compression]'
'-5[even more compression]'
'-6[slightly even more compression]'
'-7[getting there]'
'-8[close to maximum compression]'
'-9[maximum compression]')
;;
esac
fi
_arguments -C \
'--format=-[format of the resulting archive]:archive format:__git_archive_formats' \
'(- :)--list[list available archive formats]' \
'--prefix=-[prepend the given path prefix to to each filename]' \
$backend_args \
'--remote=-[archive remote repository]:remote repository:__git_any_repositories' \
':tree-ish:__git_tree_ishs' \
'*:tree file:->files' && ret=0
case $state in
(files)
__git_tree_files $line[1] && ret=0
;;
esac
}
_git-bisect () {
local bisect_cmds
@ -1488,3 +1529,13 @@ __git_local_references () {
__git_is_indexed () {
[[ -n $(git ls-files $REPLY) ]]
}
__git_archive_formats () {
local expl
declare -a formats
formats=(${${(f)"$(_call_program archive-formats git archive --list)"}})
__git_command_successful || return
_wanted archive-formats expl 'archive format' compadd $formats
}