From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24732 invoked by alias); 4 Jan 2018 17:22:43 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42221 Received: (qmail 22077 invoked by uid 1010); 4 Jan 2018 17:22:43 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(-1.4/5.0):. Processed in 2.62331 secs); 04 Jan 2018 17:22:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=Plqy=D7=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1515086544; bh=pu1q4FVhDimQlIRxIx4fLKA7NoLVGOyjxgoQ5u5T5iU=; h=From:To:Subject:Date:From:Subject; b=sj6ENHAQQB4iryaTc7g4FmDT1LHxCDnyrH9NFD/8URgySTq6PEBWlKHrh6C2ye7UcBxB4Ch1LuMnUhVEozOWNtaOsjgxnoyfditWUAWu36GqzWe8XoHGg7EANcsknzi6xdiM+LJ8mvrnaIxO5w+iJhh974ER3XbzM311UbDBRfvRsuOY2iJB1SWel36TIuaL7BwuEXKhHgdVEHB9McsCoFC2kAKF1rTIuCdnhR1l0d3rYnbYIb3FZchZDogu5et9yBqJ9XdDnTR5IcdWB61wBaSpElnNUOssW9XX5PycrJyP+s22J+C8f79NmWBYQ1Mrk9xAArn6AnbVL1RtHcX6mg== X-YMail-OSG: 3pBJ_ooVM1nZkB_tryByPhDaEfAKqf6_wCfGDoJaMY_0XbjGqn83Su8sOkywPrH yMUzo1HJ7JdfKXoOeQ_rQMzAn6GZnK.PpnCvWrRH0I0Ebd7.YBdzHzrqj6RXn45zWvtvvJgSTZ1t BOr8VBx8XIJ6H1PXYc.t1cSAgS26BEph5EoUTK.epzLTZw71W.dWRC83i7pwJ4qi_5k8iYZFECzn ijwMs8m.PNHwSlRbNWibUo__UEgGTCAuIDefsbcp66PXYpQBWMD24OQwzWhl76YoNwXCBqXYJAo. gVM6UlyvY2LC4JvbAkDjiMuyeSXDajuxg_qgFffZI8wkHow5u5C2116PtgztCIeZDkWfjzCd4ZWY tk4NdtTJlhVYmCckaHYvT01PP4zHb9kEOyIGYiQPWNzbG1Gd873LiiL4El6cptg_44S.d6ruQvOq FGW3IoMz4fdD9VfuIAWgFnQ_mSD3KSLDIg2hTIoPHXKvQ3Nk6Wf4c6sfJ6WIiJvCowB9u From: Oliver Kiddle To: Zsh workers Subject: PATCH: update enscript completion MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21740.1515086532.1@thecus.kiddle.eu> Content-Transfer-Encoding: quoted-printable Date: Thu, 04 Jan 2018 18:22:12 +0100 Message-ID: <21741.1515086532@thecus.kiddle.eu> This updates enscript completion for GNU enscript 1.6.6. Options continue to lack descriptions but are updated. It also now makes an attempt at completing fonts and formats. Oliver diff --git a/Completion/Unix/Command/_enscript b/Completion/Unix/Command/_= enscript index d10acb25f..3e09da5a4 100644 --- a/Completion/Unix/Command/_enscript +++ b/Completion/Unix/Command/_enscript @@ -1,9 +1,10 @@ #compdef enscript = -local state context line curcontext=3D"$curcontext" match +local curcontext=3D"$curcontext" state line match typeset -A opt_args +local -a libpath = -_arguments -C -s \ +_arguments -C -s -S \ '( -2 --columns)-1' \ '(-1 --columns)-2' \ '(-1 -2 )--columns=3D:columns:' \ @@ -11,14 +12,11 @@ _arguments -C -s \ '(-a)--pages=3D:pages:(even odd)' \ '(--file-align)-A+:align:' \ '(-A)--file-align=3D:align:' \ - '(--header)-b+:page header:' \ - '(-b)--header=3D:page header:' \ - '(--no-header)-B' \ - '(-B)--no-header' \ + '(--header -b -B --no-header --lineprinter -l)'{-b+,--header=3D}':page = header:->formats' \ + '(--header -b -B --no-header --lineprinter -l)'{-B,--no-header} \ '(--truncate-lines)-c' \ '(-c)--truncate-lines' \ - '(--line-numbers)-C-:start line:' \ - '(-C)--line-numbers=3D-:start line:' \ + '(--line-numbers -C)'{-C-,--line-numbers=3D-}'::start line [1]' \ '(--printer -d )-P+:printer name: _printers' \ '(--printer -P)-d+:printer name: _printers' \ '( -d -P)--printer=3D:printer name: _printers' \ @@ -26,34 +24,24 @@ _arguments -C -s \ '*--setpagedevice=3D:key\:value:' \ '(--escapes)-e-:escape character:' \ '(-e)--escapes=3D-:escape character:' \ - '(--pretty-print)-E-:input language:->inputlang' \ - '(-E)--pretty-print=3D-:input language:->inputlang' \ - '(--font)-f+:fontname:' \ - '(-f)--font=3D:fontname:' \ - '(--header-font)-F+:fontname:' \ - '(-F)--header-font=3D:fontname:' \ + '(-E --highlight)'{-E-,--highlight=3D-}':input language:->inputlang' \ + '(--font -f)'{-f+,--font=3D}':fontname:->fonts' \ + '(--header-font -F)'{-F+,--header-font=3D}':fontname:->fonts' \ '(--print-anyway)-g' \ '(-g)--print-anyway' \ '(--fancy-header)-G' \ - '(-G)--fancy-header=3D-:name:' \ + '(-G)--fancy-header=3D:header:->headers' \ '(--no-job-header)-h' \ '(-h)--no-job-header' \ - '(--highlight-bars)-H-:lines:' \ - '(-H)--highlight-bars=3D-:lines:' \ - '(--indent)-i+:indent length:' \ - '(-i)--indent=3D:indent length:' \ - '(--filter)-I+:input filter:->commandline' \ - '(-I)--filter=3D:input filter:->commandline' \ + '(--highlight-bars -H)'{-H-,--highlight-bars=3D-}'::height (lines) [2]'= \ + '(--indent -i)'{-i+,--indent=3D}':indent width' \ + '(--filter -I)'{-I+,--filter=3D}':input filter:_cmdstring' \ '(--borders)-j' \ '(-j)--borders' \ - '(--page-prefeed)-k' \ - '(-k)--page-prefeed' \ - '(--no-page-prefeed)-K' \ - '(-K)--no-page-prefeed' \ - '(--lineprinter)-l' \ - '(-l)--lineprinter' \ - '(--lines-per-page)-L+:lines per page:' \ - '(-L)--lines-per-page=3D:lines per page:' \ + '(-k --page-prefeed -K --no-page-prefeed)'{-k,--page-prefeed} \ + '!(-k --page-prefeed -K --no-page-prefeed)'{-K,--no-page-prefeed} \ + '(--lineprinter -l --lines-per-page -L --header -b -B --no-header)'{-l,= --lineprinter} \ + '(--lines-per-page -L --lineprinter -l)'{-L+,--lines-per-page=3D}':line= s per page' \ '(--mail)-m' \ '(-m)--mail' \ '(--media)-M+:media name:(A4)' \ @@ -63,37 +51,30 @@ _arguments -C -s \ '( -n -#)--copies=3D:number of copies:' \ '(--newline)-N+:newline type:((n\:unix r\:mac))' \ '(-N)--newline=3D:newline type:((n\:unix r\:mac))' \ - '(--output -p )-o+:output file:' \ - '(--output -o)-p+:output file:_files' \ - '( -p -o)--output=3D:output file:_files' \ + '(-o -p --output -p)'{-o+,-p+,--output=3D}':output file:_files' \ '(--missing-characters)-O' \ '(-O)--missing-characters' \ '(--quiet --silent)-q' \ '(-q --silent)--quiet' \ '(-q --quiet)--silent' \ - '(--landscape)-r' \ - '(-r)--landscape' \ - '(--portrait)-R' \ - '(-R)--portrait' \ - '(--baselineskip)-s+:baseline skip:' \ - '(-s)--baselineskip=3D:baseline skip:' \ + '(-r --landscape -R --portrait)'{-r,--landscape} \ + '(-r --landscape -R --portrait)'{-R,--portrait} \ + '(--baselineskip -s)'{-s+,--baselineskip=3D}':baseline skip (PostScript= points) [1]' \ '*-S+:key\:value:' \ '*--statusdict=3D:key\:value:' \ '(--title -t )-J+:banner title:' \ '(--title -J)-t+:banner title:' \ '( -t -J)--title=3D:banner title:' \ - '(--tabsize)-T+:tabsize:(8)' \ - '(-T)--tabsize=3D:tabsize:(8)' \ + '(--tabsize -T)'{-T+,--tabsize=3D}':tabsize [8]' \ '(--underlay)-u-:underlay text:' \ '(-u)--underlay=3D-:underlay text:' \ '(--nup)-U+:pages:(4)' \ '(-U)--nup=3D:pages:(4)' \ '(--verbose)-v' \ '(-v)--verbose=3D-:level:' \ - '(--version)-V' \ - '(-V)--version' \ - '(--language)-W+:output language:(PostScript html overstrike rtf)' \ - '(-W)--language=3D:output language:(PostScript html overstrike rtf)' \ + '(- *)'{-V,--version} \ + '(-w --language)'{-w-,--language=3D}':output language:(PostScript html = overstrike rtf)' \ + '(-W --option)'{-W-,--option=3D}':helper option' \ '(--encoding)-X+:character encoding:(88591 latin1 88592 latin2 88593 la= tin3 88594 latin4 88595 cyrillic 88597 greek 88599 latin5 885910 latin6 as= cii asciifise asciifi asciise asciidkno asciidk asciino ibmpc pc dos mac v= ms hp8 koi8 ps PS pslatin1 ISOLatin1Encoding)' \ '(-X)--encoding=3D:character encoding:(88591 latin1 88592 latin2 88593 = latin3 88594 latin4 88595 cyrillic 88597 greek 88599 latin5 885910 latin6 = ascii asciifise asciifi asciise asciidkno asciidk asciino ibmpc pc dos mac= vms hp8 koi8 ps PS pslatin1 ISOLatin1Encoding)' \ '(--no-formfeed)-z' \ @@ -101,47 +82,111 @@ _arguments -C -s \ '(--pass-through)-Z' \ '(-Z)--pass-through' \ '--color=3D-:use color:(false true)' \ + '--continuous-page-numbers' \ '--download-font=3D:fontname:' \ + '--extended-return-values' \ '--filter-stdin=3D:stdin name:(-)' \ + '--footer=3D:page footer:->formats' \ '--h-column-height=3D:horizontal column height:' \ - '--help' \ - '--help-pretty-print' \ - '--highlight-bar-gray=3D:gray level:' \ + '(- *)--help' \ + '(- *)--help-highlight' \ + '--highlight-bar-gray=3D:gray level (0-1):' \ '--list-media' \ - '--list-options' \ '--margins=3D:left\:right\:top\:bottom:' \ - '--mark-wrapped-lines=3D-:wrapped line style:(none plus box arrow)' \ - '--non-printable-format=3D:format to visualze non printable characters:= (caret octal questionmark space)' \ - '--nup-xpad=3D:x-padding:(10)' \ - '--nup-ypad=3D:y-padding:(10)' \ + '--mark-wrapped-lines=3D-:wrapped line style [none]:(none plus box arro= w)' \ + '--non-printable-format=3D:rendering of non-printable characters:(caret= octal questionmark space)' \ + '--nup-columnwise' \ + '--nup-xpad=3D:x-padding [10]' \ + '--nup-ypad=3D:y-padding [10]' \ '--page-label-format=3D:page label format:(short long)' \ '--ps-level=3D:PostScript language level:(1 2)' \ '--printer-options=3D:extra options:' \ '--rotate-even-pages' \ - '--slice=3D:virtical slice number:' \ - '--style=3D:highlighting style:' \ + '--slice=3D:vertical slice number' \ + '--style=3D:highlighting style:(a2ps emacs emacs_verbose ifh msvc)' \ + '--swap-even-page-margins' \ '--toc' \ '--word-wrap' \ - '--ul-angle=3D:underlay text'\''s angle:(45)' \ - '--ul-font=3D:underlay text'\''s fontname:(Times-Roman200)' \ - '--ul-gray=3D:underlay text'\''s gray level:(.8)' \ - '--ul-position=3D:underlay text'\''s position:(+0+0 -0-0)' \ - '--ul-style=3D:underlay text'\''s style:(outline filled)' \ + '--ul-angle=3D:angle' \ + '--ul-font=3D:fontname [Times-Roman200]:->fonts' \ + '--ul-gray=3D:gray level (0..1) [.8]' \ + '--ul-position=3D:position [+0+0 -0-0]' \ + '--ul-style=3D:style [outline]:(outline filled)' \ '*:filename:_files' && return 0 = case "$state" in -commandline) - compset -q - _normal + fonts) + if compset -P 1 '*@'; then + _message -e size 'pointsize, optionally width/height' + else + libpath=3D( {${commands[enscript]:h:h},/usr}/share/enscript/afm/fon= t.map(N) ) + _wanted fonts expl font compadd -qS @ - ${${(f)"$(<$libpath[1])"}%%= *} + fi ;; - -inputlang) - if (( ! $+_enscript_input_languages )); then - _enscript_input_languages=3D(${${(f)${(F)${(M)${(f)"$(enscript --help= -pretty-print)"}:#(Name|Description):*}}//(#b)Name: ([^ + formats) + local -a specs + local suf=3D'{' + compquote suf + if [[ ${PREFIX} =3D *[%$]D${suf}[^}]# ]]; then + _strftime + elif [[ ${(Q)PREFIX} =3D *\$\([^\)]# ]]; then + compset -P '*\(' + _parameters -g '*export*' -S '\)' + elif [[ ${(Q)PREFIX} =3D *\$ ]]; then + specs=3D( + '$:a dollar symbol' + '%:current page number' + '=3D:number of pages in the current file' + 'p:number of pages processed so far' + {C,\*}':file modification time (hh:mm:ss)' + 'n:basename of the input file name' + 'N:full input file name' + 'E:file modification date (yy/mm/dd)' + 'F:file modification date (dd.mm.yyyy)' + 't:file modification time (12-hour)' + 'T:file modification time (24-hour)' + 'v:sequence number of current input file' + 'V:sequence number of current input file in table of contents format' + 'W:file modification date (mm/dd/yy)' + '\(:environment variable' + ) + compset -P "*" + _describe -t format-specifiers 'format specifier' specs -S '' -- '(= D:modification\ date )' -qS $suf + elif [[ ${(Q)PREFIX} =3D *% ]]; then + specs=3D( + 'c:trailing component of the current working directory' + {C,\*}':current time (hh:mm:ss)' + 'E:current date (yy/mm/dd)' + 'F:current date (dd.mm.yyyy)' + 'H:document title' + 'L:lines in the input file' + 'm:hostname in short form' + 'M:hostname in fully qualified form' + 'n:user login name' + 'N:user gecos field first component' + 't:current time (12-hour)' + 'T:current time (24-hour)' + 'W:current date (mm/dd/yy)' + ) + compset -P "*" + _describe -t format-specifiers 'format specifier' specs -S '' -- '(= D:current\ time )' -qS $suf + else + compset -P "*" + _wanted format-specifiers expl 'format specifier' compadd -S '' % \= $ + fi + ;; + headers) + libpath=3D( {${commands[enscript]:h:h},/usr}/share/enscript(N/) ~/.en= script(N/) ) + _wanted headers expl header compadd $^libpath/*.hdr(N:r:t) + ;; + inputlang) + if (( ! $+_cache_enscript_languages )); then + typeset -ga _cache_enscript_languages + _cache_enscript_languages=3D(${${(f)${(F)${(M)${(f)"$(_call_program= languages enscript --help-pretty-print)"}:#(Name|Description):*}}//(#b)Na= me: ([^ ]##)( Description: ([^ ]##)|)/$match[1]:$match[3]}%:}) - fi - _describe 'input language' _enscript_input_languages -- = + fi + _describe -t languages 'input language' _cache_enscript_languages ;; esac