[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 0e9f5a38506bb2e009a7b0d7beda9b0bacd25a32
Freddy Vulto
fvulto at gmail.com
Fri Sep 25 07:59:55 UTC 2009
The following commit has been merged in the master branch:
commit 0e9f5a38506bb2e009a7b0d7beda9b0bacd25a32
Author: Freddy Vulto <fvulto at gmail.com>
Date: Fri Sep 25 09:57:37 2009 +0200
Fixed contrib/ri
Too much lines were deleted accidentally at the previous commit.
diff --git a/contrib/ri b/contrib/ri
index 80ee6e5..8a3599d 100644
--- a/contrib/ri
+++ b/contrib/ri
@@ -1,4 +1,32 @@
-_path ${classes[@]} | ruby -ane 'if /^-/.../^-/ and \
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# ri completion for Ruby documentation by Ian Macdonald <ian at caliban.org>
+
+have ri && {
+ri_get_methods()
+{
+ local regex
+
+ if [ "$ri_version" = integrated ]; then
+ if [ -z "$separator" ]; then
+ regex="(Instance|Class)"
+ elif [ "$separator" = "#" ]; then
+ regex=Instance
+ else
+ regex=Class
+ fi
+
+ COMPREPLY=( ${COMPREPLY[@]} \
+ "$( ri ${classes[@]} 2>/dev/null | \
+ ruby -ane 'if /^'"$regex"' methods:/.../^------------------|^$/ and \
+ /^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \
+ end' | sort -u )" )
+ else
+ # older versions of ri didn't distinguish between class/module and
+ # instance methods
+ COMPREPLY=( ${COMPREPLY[@]} \
+ "$( ruby -W0 $ri_path ${classes[@]} | ruby -ane 'if /^-/.../^-/ and \
! /^-/ and ! /^ +(class|module): / then \
print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
end' | sort -u )" )
--
bash-completion
More information about the Bash-completion-commits
mailing list