zsh-workers
 help / color / mirror / code / Atom feed
From: "Alexey I. Froloff" <raorn@altlinux.org>
To: Zsh list <zsh-workers@zsh.org>
Subject: [PATCH] Completion/Unix/Commands/_ri: updated for Ruby 1.9.2
Date: Fri, 31 Dec 2010 01:41:22 +0300	[thread overview]
Message-ID: <1293748882-3197-1-git-send-email-raorn@altlinux.org> (raw)

In Ruby 1.9.2 extension of compiled RI files changed from .yaml
to .ri, choose extension accorting to RI version.

"plain" formatter was removed, use "bs" formatter and filter output
through "col".

Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
---
 Completion/Unix/Command/_ri |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Completion/Unix/Command/_ri b/Completion/Unix/Command/_ri
index a7f2692..7474374 100644
--- a/Completion/Unix/Command/_ri
+++ b/Completion/Unix/Command/_ri
@@ -21,17 +21,23 @@ _arguments \
   '*:ri name:->ri-name' && ret=0
 
 if [[ "$state" = ri-name ]]; then
-  local -a ri_dirs ri_names ri_wants ri_names
+  local -a ri_dirs ri_ext ri_names ri_wants ri_names
   local class_dir esc_name dir curtag tag descr expl
 
   ret=1
 
-  if "ruby${words[1]#ri}" -rrdoc/ri/ri_options.rb -e 1 >/dev/null 2>&1; then
+  if "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e 1 >/dev/null 2>&1; then
     # Old-style Ruby 1.8.x RI
     ri_dirs=( ${(f)"$(_call_program ri-names "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e '"o = RI::Options.instance; o.parse(ARGV); o.path.each { |p| puts p }"' -- ${(kv)opt_args[(I)-d|--doc-dir|--(system|site|gems|home)]})"} )
+    ri_ext=yaml
+  elif "ruby${words[1]#ri}" -rrdoc/ri -rrdoc/ri/store -e 1 >/dev/null 2>&1; then
+    # Newer-style Ruby 1.9.2 RI
+    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)"} )
+    ri_ext=ri
   else
     # New-style Ruby 1.9+ RI
     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)"} )
+    ri_ext=yaml
   fi
 
   if compset -P '?*(::|\#|.)'; then
@@ -64,14 +70,14 @@ if [[ "$state" = ri-name ]]; then
           ;;
           (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]")} )
+            fnames=( $dir/$class_dir*-c.$ri_ext(-.:t) )
+            ri_wants+=( ${${fnames%-c.$ri_ext}//(#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]")} )
+            fnames=( $dir/$class_dir*-i.$ri_ext(-.:t) )
+            ri_wants+=( ${${fnames%-i.$ri_ext}//(#b)%(??)/$(print "\\x$match[1]")} )
           done
           ;;
         esac
-- 
1.7.3.2


             reply	other threads:[~2010-12-30 22:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-30 22:41 Alexey I. Froloff [this message]
2011-01-04 11:32 ` Alexey I. Froloff
2011-01-05 21:27   ` Benjamin R. Haskell
2011-01-06  0:30     ` Alexey I. Froloff
2011-01-06  6:07       ` Benjamin R. Haskell
2011-01-06  6:01 ` [PATCH] Completion/Unix/Commands/_ri: missed format change Benjamin R. Haskell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1293748882-3197-1-git-send-email-raorn@altlinux.org \
    --to=raorn@altlinux.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).