@@ -70,7 +70,7 @@ _comp_cmd_ri()
70
70
return
71
71
fi
72
72
73
- local class method prefix=" " ri_path ri_version ri_major=" " separator IFS
73
+ local class method prefix=" " ri_path ri_version ri_major=" " separator
74
74
local -a classes
75
75
76
76
ri_path=$( type -p ri)
@@ -82,35 +82,33 @@ _comp_cmd_ri()
82
82
[[ $ri_version =~ ri[[:space:]]v? ([0-9]+) ]] && ri_major=${BASH_REMATCH[1]}
83
83
84
84
# need to also split on commas
85
- IFS=$' , \n\t '
86
85
if [[ $cur == [A-Z]* [# .]* ]]; then
87
86
[[ $cur == * # * ]] && separator=# || separator=.
88
87
# we're completing on class and method
89
88
class= ${cur% " $separator " * }
90
89
method= ${cur#* " $separator " }
91
- classes= ( $class )
90
+ _comp_split -F $' , \n\t ' classes " $class "
92
91
prefix= $class$separator
93
92
_comp_compgen -c " $method " -i ri methods
94
93
return
95
94
fi
96
95
97
96
if [[ $ri_version == integrated ]]; then
98
97
# integrated ri from Ruby 1.9
99
- classes=($( ri -c 2> /dev/null | ruby -ne ' if /^\s*$/..$stdin.eof then \
100
- if /^ +[A-Z]/ then print; end; end' 2> /dev/null) )
98
+ _comp_split -F $' , \n\t ' classes \
99
+ " $( ri -c 2> /dev/null | ruby -ne ' if /^\s*$/..$stdin.eof then \
100
+ if /^ +[A-Z]/ then print; end; end' 2> /dev/null) "
101
101
elif [[ $ri_major && $ri_major -ge 3 ]]; then
102
- classes=( $( ri -l 2> /dev/null) )
102
+ _comp_split -F $' , \n\t ' classes " $( ri -l 2> /dev/null) "
103
103
elif [[ $ri_version == " ri 1.8a" ]]; then
104
- classes=( $( ruby -W0 " $ri_path " |
104
+ _comp_split -F $' , \n\t ' classes " $( ruby -W0 " $ri_path " |
105
105
ruby -ne ' if /^' " '" ' ri' " '" ' has/..$stdin.eof then \
106
- if /^ .*[A-Z]/ then print; end; end' ) )
106
+ if /^ .*[A-Z]/ then print; end; end' ) "
107
107
else
108
- classes=( $( ruby -W0 " $ri_path " |
108
+ _comp_split -F $' , \n\t ' classes " $( ruby -W0 " $ri_path " |
109
109
ruby -ne ' if /^I have/..$stdin.eof then \
110
- if /^ .*[A-Z]/ then print; end; end' ) )
111
- fi
112
-
113
- (( ${# classes[@]} )) &&
110
+ if /^ .*[A-Z]/ then print; end; end' ) "
111
+ fi &&
114
112
_comp_compgen -- -W ' "${classes[@]}"'
115
113
_comp_ltrim_colon_completions " $cur "
116
114
0 commit comments