From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21678 invoked from network); 1 Oct 2009 23:25:25 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 1 Oct 2009 23:25:25 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 20460 invoked from network); 1 Oct 2009 23:25:20 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Oct 2009 23:25:20 -0000 Received: (qmail 15315 invoked by alias); 1 Oct 2009 23:25:16 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27301 Received: (qmail 15300 invoked from network); 1 Oct 2009 23:25:15 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 1 Oct 2009 23:25:15 -0000 Received: from vint.altlinux.org (vint.altlinux.org [194.107.17.35]) by bifrost.dotsrc.org (Postfix) with ESMTP id 57A878058CAB for ; Fri, 2 Oct 2009 01:25:07 +0200 (CEST) Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vint.altlinux.org (Postfix) with ESMTP id 2F4943F80019 for ; Thu, 1 Oct 2009 23:25:05 +0000 (UTC) Received: from [213.85.39.63] (unknown [213.85.39.63]) by imap.altlinux.org (Postfix) with ESMTPSA id 3F89F3E48D3C for ; Fri, 2 Oct 2009 03:25:01 +0400 (MSD) Received: by hell.fortress (Postfix, from userid 500) id 1900E36000D6; Fri, 2 Oct 2009 03:24:59 +0400 (MSD) Date: Fri, 2 Oct 2009 03:24:58 +0400 From: "Alexey I. Froloff" To: Zsh list Subject: Completion for ri (Ruby API reference frontend) Message-ID: <20091001232458.GG22325@altlinux.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7SrMUQONj8Rl9QNG" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-23) X-Virus-Scanned: ClamAV 0.94.2/9859/Thu Oct 1 17:14:27 2009 on bifrost X-Virus-Status: Clean --7SrMUQONj8Rl9QNG Content-Type: multipart/mixed; boundary="Q6STzHxy03qt/hK9" Content-Disposition: inline --Q6STzHxy03qt/hK9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Will complete classes, class methods and instance methods. --=20 Regards, Sir Raorn. --Q6STzHxy03qt/hK9 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=_ri #compdef ri local context="$curcontext" state line ret=1 typeset -A opt_args _arguments \ '(- *)'{-h,--help}'[print help information and exit]' \ '(- *)'{-v,--version}'[display the version of ri]' \ '*'{-d,--doc-dir}'[directory to search for documentation]:ri doc directory:_files -/' \ '(-f --fmt --format)'{-f,--fmt,--format}'[format to use when displaying output]:output format:(ansi bs html plain simple)' \ '(-T --no-pager)'{-T,--no-pager}'[send output directly to stdout]' \ '(-i, --interactive)'{-i,--interactive}'[interactive mode]' \ '--list-doc-dirs[list the directories from which ri will source documentation]' \ '(-w --width)'{-w,--width}'[set the width of the output]:output width:' \ '--no-standard-docs[do not include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc]' \ '(--no-use-cache --use-cache)--'{no-,}'use-cache[whether or not to use ri'\''s cache]' \ '(--no-system --system)--'{no-,}'system[include documentation from Ruby'\''s standard library]' \ '(--no-site --site)--'{no-,}'site[include documentation from libraries installed in site_lib]' \ '(--no-gems --gems)--'{no-,}'gems[include documentation from RubyGems]' \ '(--no-home --home)--'{no-,}'home[include documentation stored in ~/.rdoc]' \ '*:ri name:->ri-name' && ret=0 if [[ "$state" = ri-name ]]; then local -a ri_dirs ri_names ri_wants ri_names local class_dir esc_name dir curtag tag descr expl ret=1 ri_dirs=( ${(f)"$(_call_program ri-names "$words[1]" ${(kv)opt_args[(I)-d|--doc-dir|--((no-|)(system|site|gems|home)|standard-docs)]} --list-doc-dirs -f plain -T)"} ) if compset -P '?*(::|\#|.)'; then class_dir=${IPREFIX//(::|\#|.)/\/} #else # : fi esc_name=${${(Q)PREFIX}//(#b)([^A-Za-z0-9_])/$(printf %%%x ${(qq)match[1]})} case "$IPREFIX" in (*::) ri_wants=( 'classes:class names' 'class-methods:class methods' );; (*\#) ri_wants=( 'instance-methods:instance methods' );; (*.) ri_wants=( 'class-methods:class methods' 'instance-methods:instance methods' );; (*) ri_wants=( 'classes:class names' ) esac for curtag in $ri_wants; do tag=${curtag%%:*} descr=${curtag#*:} _tags "$tag" while _tags; do while _next_label "$tag" expl "$descr"; do ri_wants=() case "$tag" in (classes) for dir in $ri_dirs[@]; do ri_wants+=( $dir/$class_dir*(-/:t) ) done ;; (class-methods) for dir in $ri_dirs[@]; do fnames=( $dir/$class_dir*-c.yaml(-.:t) ) ri_wants+=( ${${fnames%-c.yaml}//(#b)%(??)/$(print "\\x$match[1]")} ) done ;; (instance-methods) for dir in $ri_dirs[@]; do fnames=( $dir/$class_dir*-i.yaml(-.:t) ) ri_wants+=( ${${fnames%-i.yaml}//(#b)%(??)/$(print "\\x$match[1]")} ) done ;; esac ri_names=( ${(Q)ri_wants} ) compadd -S '' -d ri_names -a "$expl[@]" ri_wants && ret=0 done (( ret )) || break done done fi return ret --Q6STzHxy03qt/hK9-- --7SrMUQONj8Rl9QNG Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkrFOkYACgkQVqT7+fkT8wrYWQCgg7bARM82giPX6lM6kwFyzKbt 6OQAoLYvFJDt8vwLlIvPgoizuFVPMJqc =84DP -----END PGP SIGNATURE----- --7SrMUQONj8Rl9QNG--