Fixed contrib/ri
Too much lines were deleted accidentally at the previous commit.
This commit is contained in:
parent
e0feeacd54
commit
0e9f5a3850
30
contrib/ri
30
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@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 \
|
! /^-/ and ! /^ +(class|module): / then \
|
||||||
print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
|
print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
|
||||||
end' | sort -u )" )
|
end' | sort -u )" )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user