From 6cc1204ea97b3c02da1b3d2a4df93712f0c5fefb Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Tue, 7 Sep 1999 12:54:47 +0000 Subject: zsh-workers/7690 --- Completion/User/_gprof | 51 +++++++++++++++++++++++++++++++++++++++++++++---- Completion/User/_gs | 52 +++++++++++++++++++++++++++++++++++++++++++------- Completion/User/_gv | 30 +++++++++++++++++++++++++++-- Completion/User/_patch | 31 +++++++++++++++++++++--------- Completion/User/_xargs | 8 +++++--- 5 files changed, 147 insertions(+), 25 deletions(-) (limited to 'Completion/User') diff --git a/Completion/User/_gprof b/Completion/User/_gprof index 66354c875..aec50e0d6 100644 --- a/Completion/User/_gprof +++ b/Completion/User/_gprof @@ -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 diff --git a/Completion/User/_gs b/Completion/User/_gs index a216e6325..7e86981e9 100644 --- a/Completion/User/_gs +++ b/Completion/User/_gs @@ -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 (x):' \ - '-r-:resolution ( or x):' \ - '-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 (x):' \ + '-r-[set resolution]:resolution ( or x):' \ + '-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 diff --git a/Completion/User/_gv b/Completion/User/_gv index 546f760ac..b98258c89 100644 --- a/Completion/User/_gv +++ b/Completion/User/_gv @@ -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)' \ diff --git a/Completion/User/_patch b/Completion/User/_patch index 0c66f99dd..9c5bc0269 100644 --- a/Completion/User/_patch +++ b/Completion/User/_patch @@ -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' \ -- \ diff --git a/Completion/User/_xargs b/Completion/User/_xargs index 71aff222f..a72592e03 100644 --- a/Completion/User/_xargs +++ b/Completion/User/_xargs @@ -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' -- cgit 1.4.1