1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 17:24:50 +01:00

zsh-workers/7495

This commit is contained in:
Tanaka Akira 1999-08-26 11:07:42 +00:00
parent 9b20f822d0
commit f77d7a9123
51 changed files with 473 additions and 7 deletions

View file

@ -331,9 +331,12 @@ while [[ cur -gt 0 ]]; do
if [[ -n "$uns" ]]; then
uns="${(j::)${(@k)oneshot[(I)${ws[1][1]}[$uns]]#[-+]}}"
unset "opts[${(@)^opts[(I)${ws[1][1]}[$uns]]}]" \
"dopts[${(@)^dopts[(I)${ws[1][1]}[$uns]]}]" \
"odopts[${(@)^odopts[(I)${ws[1][1]}[$uns]]}]"
tmp=(
"opts[${(@)^opts[(I)${ws[1][1]}[$uns]]}]"
"dopts[${(@)^dopts[(I)${ws[1][1]}[$uns]]}]"
"odopts[${(@)^odopts[(I)${ws[1][1]}[$uns]]}]"
)
(( $#tmp )) && unset "$tmp[@]"
fi
# If we didn't find a matching option description and we were
@ -442,9 +445,12 @@ else
if [[ -n "$uns" ]]; then
uns="${(j::)${(@k)oneshot[(I)${ws[1][1]}[$uns]]#[-+]}}"
unset "opts[${(@)^opts[(I)${pre[1]}[$uns]]}]" \
"dopts[${(@)^dopts[(I)${pre[1]}[$uns]]}]" \
"odopts[${(@)^odopts[(I)${pre[1]}[$uns]]}]"
tmp=(
"opts[${(@)^opts[(I)${pre[1]}[$uns]]}]"
"dopts[${(@)^dopts[(I)${pre[1]}[$uns]]}]"
"odopts[${(@)^odopts[(I)${pre[1]}[$uns]]}]"
)
(( $#tmp )) && unset "$tmp[@]"
fi
if [[ -n "$opt" ]]; then
@ -458,7 +464,7 @@ else
if [[ -n "$sopts" && -n "$PREFIX" && "$PREFIX" = [-+]${~soptseq}[$sopts] ]]; then
if [[ "$PREFIX" = [-+]${~soptseq1} ]]; then
compadd "$expl[@]" -Q \
-y "( ${(k)opts} ${(k)dopts} ${(k)odopts} )" - \
-y "( ${(j: :)${(@M)${(@k)opts}:#[-+]?}} ${(j: :)${(@M)${(@k)dopts}:#[-+]?}} ${(j: :)${(@M)${(@k)odopts}:#[-+]?}} )" - \
"${PREFIX}${(@k)^opts[(I)${PREFIX[1]}?]#?}" \
"${PREFIX}${(@k)^dopts[(I)${PREFIX[1]}?]#?}" \
"${PREFIX}${(@k)^odopts[(I)${PREFIX[1]}?]#?}" && ret=0

14
Completion/Cvs/_cvs Normal file
View file

@ -0,0 +1,14 @@
#compdef cvs
# "+Qqrwtnlvb:T:e:d:Hfz:s:xa"
_arguments -s \
-{a,f,H,l,n,Q,q,r,t,v,w,x} \
'--version' '--help' '--help-commands' '--help-synonyms' '--help-options' \
'--allow-root=-:rootdir:_files -/' \
'-b+:bindir:_cvs_bindir' \
'-T+:temporary directory:_cvs_tempdir' \
'-d+:cvsroot:_cvs_root' \
'-e+:editor:_cvs_editor' \
'-s+:user variable:_cvs_user_variable' \
'-z:gzip level:_cvs_gzip_level' \
'*::cvs command:_cvs_command'

3
Completion/Cvs/_cvs_D Normal file
View file

@ -0,0 +1,3 @@
#autoload
compadd "$@" today yesterday week\ ago month\ ago

7
Completion/Cvs/_cvs_add Normal file
View file

@ -0,0 +1,7 @@
#autoload
# "+k:m:"
_arguments -s \
'-k+:keyword substitution:_cvs_k' \
'-m+:message:_cvs_m' \
'*:file:_cvs_files_unmaintained' \

21
Completion/Cvs/_cvs_admin Normal file
View file

@ -0,0 +1,21 @@
#autoload
# "+ib::c:a:A:e:l::u::LUn:N:m:o:s:t::IqxV:k:"
_arguments -s \
-{i,L,U,I,q,x} \
'-b-:default branch:(1.1.1)' \
'-c+:comment leader (not used):' \
'-a+:login names (not work with CVS):' \
'-A+:access list to append (not work with CVS):' \
'-e+:access list to erase (not work with CVS):' \
'-l-:revision to lock:' \
'-u-:revision to unlock:' \
'-n+:symbolic-name[\:revision]:' \
'-N+:symbolic-name[\:revision]:' \
'-m+:revision\:msg:' \
'-o+:range to delete:' \
'-s+:state[\:revision]:' \
'-t-:descriptive text:_cvs_admin_t' \
'-V+:version (obsolete):' \
'-k+:keyword substitution:_cvs_k' \
'*:file:_cvs_files'

View file

@ -0,0 +1,7 @@
#autoload
if compset -P -; then
_message 'descriptive text'
else
_files "$@"
fi

View file

@ -0,0 +1,8 @@
#autoload
# "+lr:D:fR"
_arguments -s \
-{l,f,R} \
'-r+:tag:_cvs_revisions' \
'-D+:date:_cvs_D' \
'*:file:_cvs_files'

View file

@ -0,0 +1,3 @@
#autoload
compadd "$@" /usr/local/bin || _files "$@" -/

View file

@ -0,0 +1,11 @@
#autoload
# "+ANnk:d:flRpQqcsr:D:j:P"
_arguments -s \
-{A,N,n,f,l,R,q,c,s,P} \
'-k+:keyword substitution:_cvs_k' \
'-d+:directory:_files -/' \
'-r+:tag:_cvs_revisions' \
'-D+:date:_cvs_D' \
'-j+:tag:_cvs_revisions' \
'*:module:_cvs_modules'

View file

@ -0,0 +1,42 @@
#autoload
typeset -A commands
commands=(add "ad new" admin "adm rcs" annotate ann
checkout "co get" commit "ci com" diff "di dif"
edit "" editors "" export "exp ex"
history "hi his" import "im imp" init ""
log "lo rlog" login "logon lgn" logout ""
rdiff patch release "re rel" remove "rm delete"
status "st stat" rtag "rt rfreeze" tag "ta freeze"
unedit "" update "up upd" watch ""
watchers "")
if (( CURRENT == 1 )); then
compadd ${(k)commands} || compadd ${(kv)=commands}
else
case "$words[1]" in
add|ad|new) _cvs_add;;
admin|adm|rcs) _cvs_admin;;
annotate|ann) _cvs_annotate;;
checkout|co|get) _cvs_checkout;;
commit|ci|com) _cvs_commit;;
diff|di|dif) _cvs_diff;;
edit) _cvs_edit;;
editors) _cvs_editors;;
export|exp|ex) _cvs_export;;
history|hi|his) _cvs_history;;
import|im|imp) _cvs_import;;
init) _cvs_init;;
login|logon|lgn|logout) _cvs_login;;
rdiff|patch|pa) _cvs_rdiff;;
release|re|rel) _cvs_release;;
remove|rm|delete) _cvs_remove;;
status|st|stat) _cvs_status;;
tag|ta|freeze) _cvs_tag;;
unedit) _cvs_unedit;;
update|up|upd) _cvs_update;;
watch) _cvs_watch;;
watchers) _cvs_watchers;;
*) _message "unknown cvs command: $words[1]";;
esac
fi

View file

@ -0,0 +1,9 @@
#autoload
# "+nlRm:fF:r:"
_arguments -s \
-{n,l,R,f} \
'-m+:message:_cvs_m' \
'-F+:log message file:_files' \
'-r+:tag:_cvs_revisions' \
'*:file:_cvs_files_modified'

15
Completion/Cvs/_cvs_diff Normal file
View file

@ -0,0 +1,15 @@
#autoload
# "+abcdefhilnpstuw0123456789BHNRC:D:F:I:L:U:V:W:k:r:"
_arguments -s \
-{a,b,c,d,e,f,h,i,l,n,p,s,t,u,w,0,1,2,3,4,5,6,7,8,9,B,H,N,R} \
'-C:lines:' \
'-D+:date:_cvs_D' \
'-F+:regex:' \
'-I+:regex:' \
'*-L+:label:' \
'-U:lines:' \
'-W:columns:' \
'-k+:keyword substitution:_cvs_k' \
'-r+:tag:_cvs_revisions' \
'*:file:_cvs_diff_arg'

View file

@ -0,0 +1,3 @@
#autoload
_cvs_files_modified || _cvs_files

View file

@ -0,0 +1,8 @@
#autoload
if [[ -d ${pref}CVS ]]; then
_cvs_setup_direntries
(( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
else
_files "$@"
fi

7
Completion/Cvs/_cvs_edit Normal file
View file

@ -0,0 +1,7 @@
#autoload
# "+lRa:"
_arguments -s \
-{l,R} \
'-a+:action:(edit unedit commit all none)'
'*:file:_cvs_files'

View file

@ -0,0 +1,3 @@
#autoload
compadd "$@" vi

View file

@ -0,0 +1,6 @@
#autoload
# "+lR"
_arguments -s \
-{l,R} \
'*:file:_cvs_files'

View file

@ -0,0 +1,10 @@
#autoload
# "+Nnk:d:flRQqr:D:"
_arguments -s \
-{N,n,f,l,R,Q,q} \
'-k+:keyword substitution:_cvs_k' \
'-d+:directory:_files -/' \
'-r+:tag:_cvs_revisions' \
'-D+:date:_cvs_D' \
'*:module:_cvs_modules'

View file

@ -0,0 +1,3 @@
#autoload
entries=($entries ${${${(M)rawentries:#D/*}#D/}%%/*})

View file

@ -0,0 +1,3 @@
#autoload
entries=($entries ${${${(M)rawentries:#/*}#/}%%/*})

View file

@ -0,0 +1,13 @@
#autoload
if [[ -n "$compconfig[_cvs_disable_stat]" ]] ||
! { zmodload -e stat || zmodload stat }; then
_cvs_extract_file_entries
return
fi
local ents pats
ents=(${${${${(M)rawentries:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#})
pats=(${${${(f)"$(LANG=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${pref}*(D))"}##*/}/ //})
eval 'ents=(${ents:#('${(j:|:)${(@)pats:q}}')})'
entries=($entries ${ents%%/*})

10
Completion/Cvs/_cvs_files Normal file
View file

@ -0,0 +1,10 @@
#autoload
local qpref pref entries
_cvs_setup_prefix
if [[ -d ${pref}CVS ]]; then
_cvs_setup_allentries
(( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
else
_files "$@"
fi

View file

@ -0,0 +1,10 @@
#autoload
local qpref pref entries
_cvs_setup_prefix
if [[ -d ${pref}CVS ]]; then
_cvs_setup_modentries
(( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
else
_files "$@"
fi

View file

@ -0,0 +1,15 @@
#autoload
local qpref pref entries
_cvs_setup_prefix
if [[ -d ${pref}CVS ]]; then
_cvs_setup_allentries
setopt localoptions unset
local omit
omit=(${pref}*(D:t))
eval 'entries=(${entries:#('${(j:|:)${(@)omit:q}}')})'
compadd "$@" -P "$qpref" - ${entries:q} ||
_cvs_directories "$@"
else
_files "$@"
fi

View file

@ -0,0 +1,26 @@
#autoload
if (( ! $+_cvs_ignore_default )); then
_cvs_ignore_default=(
RCS SCCS CVS CVS.adm RCSLOG 'cvslog.*' tags TAGS .make.state .nse_depinfo
'*\~' '\#*' '.\#*' ',*' '_$*' '*$' '*.old' '*.bak' '*.BAK' '*.orig' '*.rej'
'.del-*' '*.a' '*.olb' '*.o' '*.obj' '*.so' '*.exe' '*.Z' '*.elc' '*.ln'
core
)
fi
local qpref pref entries
_cvs_setup_prefix
if [[ -d ${pref}CVS ]]; then
_cvs_setup_allentries
setopt localoptions unset
local omit
omit=($_cvs_ignore_default ${entries:q} ${=cvsignore})
[[ -r ~/.cvsignore ]] && omit=($omit $(<~/.cvsignore))
[[ -r ${pref}.cvsignore ]] && omit=($omit $(<${pref}.cvsignore))
compgen "$@" -g '*~(*/|)('${(j:|:)omit}')(D)' ||
compgen "$@" -g '*~(*/|)('${(j:|:)${(@)entries:q}}')(D)' ||
_cvs_directories "$@"
else
_files "$@"
fi

View file

@ -0,0 +1,3 @@
#autoload
compadd "$@" 9

View file

@ -0,0 +1,18 @@
#autoload
# "+Tacelow?D:b:f:m:n:p:r:t:u:x:X:z:"
_arguments -s \
-{T,a,c,e,l,o,w,\?} \
'-D+:date:_cvs_D' \
'-b+:string:' \
'-f+:arg:' \
'-m+:module:_cvs_modules' \
'-n+:arg:' \
'*-p+:repository:' \
'-r+:rev:' \
'-t+:tag:' \
'-u+:user name:' \
'-x+:type:_cvs_history_x' \
'-X+:arg:' \
'-z+:arg:' \
'*:file:_cvs_files'

View file

@ -0,0 +1,5 @@
#autoload
compset -P '*'
# It should describe meaning.
compadd F O E T C G U W A M R

View file

@ -0,0 +1,13 @@
#autoload
# "+Qqdb:m:I:k:W:"
_arguments -s \
-{Q,q,d} \
'-b+:branch:' \
'-m+:message:_cvs_m' \
'*-I+:name:_files' \
'-k+:keyword substitution:_cvs_k' \
'*-W+:spec:' \
':repository:_cvs_modules' \
':vendor tag:' \
':release tag:'

3
Completion/Cvs/_cvs_init Normal file
View file

@ -0,0 +1,3 @@
#autoload
false

3
Completion/Cvs/_cvs_k Normal file
View file

@ -0,0 +1,3 @@
#autoload
compadd "$@" kv kvl k o b v

View file

@ -0,0 +1,3 @@
#autoload
false

3
Completion/Cvs/_cvs_m Normal file
View file

@ -0,0 +1,3 @@
#autoload
_message "log message"

View file

@ -0,0 +1,12 @@
#autoload
local root=$CVSROOT
[[ -f CVS/Root ]] && root=$(<CVS/Root)
if [[ $root = :* || ! -d $root ]]; then
_message "module name"
else
compadd - \
$root/^CVSROOT(:t) \
${${(M)${(f)"$(<$root/CVSROOT/modules)"}:#[^#]*}%%[ ]*}
fi

10
Completion/Cvs/_cvs_rdiff Normal file
View file

@ -0,0 +1,10 @@
#autoload
# "+V:k:cuftsQqlRD:r:"
_arguments -s \
-{c,u,f,t,s,Q,q,l,R} \
'-V+:version:' \
'-k+:keyword substitution:_cvs_k' \
'*-D+:date:_cvs_D' \
'*-r+:tag:_cvs_revisions' \
'*:module:_cvs_modules'

View file

@ -0,0 +1,6 @@
#autoload
# "+Qdq"
_arguments -s \
-{Q,d,q} \
'*:directory:_files -/'

View file

@ -0,0 +1,6 @@
#autoload
# "+flR"
_arguments -s \
-{f,l,R} \
'*:file:_cvs_files_removed'

View file

@ -0,0 +1,3 @@
#autoload
compadd - ${${${(M)${(f)"$(cvs -q status -vl .)"}:# *}##[ ]##}%%[ ]*}

11
Completion/Cvs/_cvs_root Normal file
View file

@ -0,0 +1,11 @@
#autoload
if (( ! $+_cvs_roots )); then
if [[ -f ~/.cvspass ]]; then
_cvs_roots=(${${(f)"$(<~/.cvspass)"}%% *})
else
_cvs_roots=()
fi
fi
compadd "$@" $_cvs_roots || _files "$@" -/

View file

@ -0,0 +1,9 @@
#autoload
entries=()
if [[ -f ${pref}CVS/Entries ]]; then
local rawentries
rawentries=(${(f)"$(<${pref}CVS/Entries)"})
_cvs_extract_file_entries
_cvs_extract_directory_entries
fi

View file

@ -0,0 +1,8 @@
#autoload
entries=()
if [[ -f ${pref}CVS/Entries ]]; then
local rawentries
rawentries=(${(f)"$(<${pref}CVS/Entries)"})
_cvs_extract_directory_entries
fi

View file

@ -0,0 +1,9 @@
#autoload
entries=()
if [[ -f ${pref}CVS/Entries ]]; then
local rawentries
rawentries=(${(f)"$(<${pref}CVS/Entries)"})
_cvs_extract_modifiedfile_entries
_cvs_extract_directory_entries
fi

View file

@ -0,0 +1,9 @@
#autoload
if [[ -prefix */ ]]; then
qpref="${PREFIX%/*}/"
pref=$~qpref
else
qpref=
pref=./
fi

View file

@ -0,0 +1,6 @@
#autoload
# "+vlR"
_arguments -s \
-{v,l,R} \
'*:file:_cvs_files'

8
Completion/Cvs/_cvs_tag Normal file
View file

@ -0,0 +1,8 @@
#autoload
# "+FQqlRcdr:D:bf"
_arguments -s \
-{F,Q,q,l,R,c,d,b,f} \
'-r+:tag:_cvs_revisions' \
'-D+:date:_cvs_D' \
'*:file:_cvs_files'

View file

@ -0,0 +1,3 @@
#autoload
compadd "$@" $TMPPREFIX:h $TMPDIR /tmp

View file

@ -0,0 +1,6 @@
#autoload
# "+lR"
_arguments -s \
-{l,R} \
'*:file:_cvs_files'

View file

@ -0,0 +1,12 @@
#autoload
# "+ApPflRQqduk:r:D:j:I:W:"
_arguments -s \
-{A,p,P,f,l,R,Q,q,d,u} \
'-k+:keyword substitution:_cvs_k' \
'-r+:tag:_cvs_revisions' \
'-D+:date:_cvs_D' \
'-j+:tag:_cvs_revisions' \
'*-I+:name:_files' \
'*-W+:spec:' \
'*:file:_cvs_files'

View file

@ -0,0 +1,7 @@
#autoload
if compset -P '*='; then
_default
else
_message "variable=value"
fi

21
Completion/Cvs/_cvs_watch Normal file
View file

@ -0,0 +1,21 @@
#autoload
if (( CURRENT == 2 )); then
compadd on off add remove
else
case "$words[2]" in
on|off) # "+lR"
_arguments -s \
-{l,R} \
':watch command:' \
':*:file:_cvs_files'
;;
add|remove) # "+lRa:"
_arguments -s \
-{l,R} \
'*-a+:action:(edit unedit commit all none)' \
':watch command:' \
':*:file:_cvs_files'
;;
esac
fi

View file

@ -0,0 +1,6 @@
#autoload
# "+lR"
_arguments -s \
-{l,R} \
':*:file:_cvs_files'