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

zsh-workers/7690

This commit is contained in:
Tanaka Akira 1999-09-07 12:54:47 +00:00
parent 77f9967f32
commit 6cc1204ea9
9 changed files with 166 additions and 27 deletions

View file

@ -740,7 +740,7 @@ while true; do
options=( "${(@kv)_options}" )
state="${${action[3,-1]##[ ]#}%%[ ]#}"
compstate[restore]=''
return 1
return 300
else
if [[ "${(t)line}" != *local* ]]; then
local line

View file

@ -1,12 +1,55 @@
#compdef gprof
local state line ret=1
typeset -A options
_arguments -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \
-{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name: _exec_funcs' \
-{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name:->funcs' \
'-I:directory:_dir_list' \
'-d-:debug level:' '-k:function names: _exec_funcs -p' \
'-d-:debug level:' '-k:function names:->pair' \
'-m:minimum execution count:' \
':executable:_files -g \*\(\*\)' \
':profile file:_files -g gmon.\*' \
-- -s '(#--[no-] --)' \
'*=name*:function name: _exec_funcs' \
'*=dirs*:directory:_dir_list'
'*=name*:function name:->funcs' \
'*=dirs*:directory:_dir_list' && ret=0
if [[ -n "$state" ]]; then
local cmd pair expl
[[ "$state" = pair ]] && pair=yes
if [[ $#line -gt 1 ]]; then
cmd="$line[2]"
else
return 1
fi
if [[ -n "$cmd" ]]; then
if [[ "$cmd" = /* ]]; then
tmp="$cmd"
else
tmp="$PWD/$cmd"
fi
if [[ "$tmp" != "$_gprof_command" ]]; then
_gprof_command="$tmp"
_gprof_funcs=( "${(@)${(@M)${(@f)$(nm $cmd)}:#[^ ]# [tT] ([^_]|_[^_])*}##* }" )
fi
if [[ -n "$pair" ]]; then
if compset -P '*/'; then
_description expl 'call arc to function'
else
_description expl 'call arc from function'
fi
else
_description expl function
fi
compadd -M 'r:|_=* r:|=*' - "$_gprof_funcs[@]" && ret=0
else
return 1
fi
fi
return ret

View file

@ -8,12 +8,50 @@ if compset -N --; then
return 1
fi
else
local state line ret=1
typeset -A options
_x_arguments \
-q \
'-g-:device size (<width>x<height>):' \
'-r-:resolution (<val> or <x>x<y>):' \
'-I:search paths:_dir_list' \
\*-{d,D}'-:def: _gs_name -d' \
\*-{s,S}'-:def: _gs_name -s' \
'*:PostScript file:_ps'
'-q[quiet startup]' \
'-g-[set device size]:device size (<width>x<height>):' \
'-r-[set resolution]:resolution (<val> or <x>x<y>):' \
'-I[add search paths]:search paths:_dir_list' \
\*-{d,D}'-[define name with definition]:def:->dname' \
\*-{s,S}'-[define name with value]:def:->sname' \
'*:PostScript file:_ps' && ret=0
case "$state" in
dname)
if [[ "$PREFIX" = *\=* ]]; then
_message 'systemdict definition value'
else
_description expl 'systemdict definition name'
compadd "$expl[@]" -M 'm:{a-z}={A-Z}' - \
DISKFONTS NOCACHE NOBIND NODISPLAY NOPAUSE PLATFONTS SAFER \
WRITESYSTEMDICT && ret=0
fi
;;
sname)
if compset -P '*\='; then
case "$IPREFIX" in
*DEVICE\=)
_description expl 'ghostscript device'
compadd "$expl[@]" - "${(@)${=${$(gs -h)##* devices:}%%Search path:*}:#}" && ret=0
;;
*OutputFile\=)
_description expl 'output file'
_files && ret=0
;;
*)
_message 'systemdict value'
return 1
esac
else
_description expl 'systemdict name'
compadd "$expl[@]" -S\= -M 'm:{a-z}={A-Z}' - DEVICE OutputFile && ret=0
fi
;;
esac
return ret
fi

View file

@ -1,8 +1,34 @@
#compdef gv gview
_xt_arguments \
-{,no}{safer,quiet,center,swap,antialias,dsc,eof,pixmap,watch,resize} \
-{monochrome,grayscale,color,portrait,landscape,upsidedown,seascape,h,help,v,spartan} \
'(-nosafer)-safer' \
'(-safer)-nosafer' \
'(-noquiet)-quiet' \
'(-quiet)-noquiet' \
'(-nocenter)-center' \
'(-center)-nocenter' \
'(-noswap)-swap' \
'(-swap)-noswap' \
'(-noantialias)-antialias' \
'(-antialias)-noantialias' \
'(-nodsc)-dsc' \
'(-dsc)-nodsc' \
'(-noeof)-eof' \
'(-eof)-noeof' \
'(-nopixmap)-pixmap' \
'(-pixmap)-nopixmap' \
'(-nowatch)-watch' \
'(-watch)-nowatch' \
'(-noresize)-resize' \
'(-resize)-noresize' \
'(-grayscale -color)-monochrome' \
'(-monochrome -color)-grayscale' \
'(-grayscale -color)-monochrome' \
'(-landscape -seascape -upsidedown)-portrait' \
'(-portrait -seascape -upsidedown)-landscape' \
'(-portrait -landscape -upsidedown)-seascape' \
'(-portrait -landscape -seascape)-upsidedown' \
-{h,help,v,spartan} \
'-arguments:ghostscript arguments:' \
'-page:label of first page:' \
'-media:page size:(Letter Legal Statement Tabloid Ledger Folio Quarto 10x14 Executive A3 A4 A5 B4 B5)' \

View file

@ -1,19 +1,32 @@
#compdef patch
_arguments -s \
'-p+:number:(0)' \
'-F+:lines:' \
-{l,c,e,n,u,N,R,E,Z,T,b,t,f,s,v} \
'(--strip)-p+:number:(0)' \
'(--fuzz)-F+:lines:' \
'(--context)-c' \
'(--ed)-e' \
'(--force)-f' \
'(--batch)-t' \
'(--ignore-whitespace)-l' \
'(--normal)-n' \
'(--forward)-N' \
'(--reverse)-R' \
'(--silent --quiet)-s' \
'(--skip)-S' \
'(--unified)-u' \
'(--version)-v' \
-{E,Z,T} \
'-i+:patch file:_files' \
'-o+:output file:_files' \
'-r+:reject file:_files' \
'-D+:name:' \
'-V+:version control style:(simple numbered existing)' \
'-B+:backup path prefix:' \
'(--output)-o+:output file:_files' \
'(--reject-file)-r+:reject file:_files' \
'(--ifdef)-D+:name:' \
'(--version-control)-V+:version control style:(simple numbered existing)' \
'(--prefix)-B+:backup path prefix:' \
'(--suffix)-b:backup extension:' \
'-Y+:backup basename prefix:_files' \
'-z+:backup file suffix:(.bak)' \
'-g+:NUM:' \
'-d+:chdir to:_files -/' \
'(--directory)-d+:chdir to:_files -/' \
':original file:_files' \
':patch file:_files' \
-- \

View file

@ -3,9 +3,11 @@
_arguments \
-{p,t,x} \
-{e-,E}':end-of-file string:' \
-{i-,I}':replacement string for lines:' \
-{l-,L}':number of input lines:' \
'-n:maximum number of arguments:' \
'(-x -I)-i-:replacement string for lines:' \
'(-x -i)-I:replacement string for lines:' \
'(-n -L -x)-l-:number of input lines:' \
'(-n -l)-L:number of input lines:' \
'(-l -L)-n:maximum number of arguments:' \
'-s:maximum command line length:' \
':command: _command_names -e' \
'*::args:_normal'

View file

@ -1,6 +1,14 @@
#compdef -P */X11/*
local ret
_arguments \
'-display:display:_x_display' \
'-geometry:geometry:_x_geometry' \
"$@"
ret=$?
[[ "$ret" = 300 ]] && compstate[restore]=''
return ret

View file

@ -20,6 +20,8 @@
# cf. XrmParseCommand(3X11), X11R6.4/xc/lib/Xt/Initialize.c, X(5)
local ret
_arguments \
-+{rv,synchronous} \
-{reverse,iconic} \
@ -42,3 +44,9 @@ _arguments \
'-xrm:resource:_x_resource' \
'-xtsessionID:session ID:_xt_session_id' \
"$@"
ret=$?
[[ "$ret" = 300 ]] && compstate[restore]=''
return ret

View file

@ -965,7 +965,8 @@ An var(action) of the form `tt(->)var(string)' is used by functions
that implement a state machine. In this case, the `var(string)' (with
all leading and trailing spaces and tabs removed) will be stored in
the global parameter tt(state) and the function returns with a return
value of one after setting the global `tt(line)' and `tt(options)'
value of 300 (to make it distinguishable from other return values)
after setting the global `tt(line)' and `tt(options)'
parameters as described below and without resetting any changes made
to the special parameters such as tt(PREFIX) and tt(words).