@@ -64,7 +64,9 @@ def require(mod, verbose = verbose?)
64
64
@load_order << mod
65
65
current_paths = loaded_paths
66
66
67
- ret = _modwhich_original_require ( mod )
67
+ ret = recursive_verbose ( verbose ) {
68
+ _modwhich_original_require ( mod )
69
+ }
68
70
69
71
@added_paths . concat ( loaded_paths - current_paths )
70
72
@which [ mod ] = @added_paths . pop || gemwhich ( mod )
@@ -87,6 +89,21 @@ def recursive?
87
89
@recursive
88
90
end
89
91
92
+ def recursive_verbose? ( verbose )
93
+ recursive? && !verbose . nil? && verbose != verbose?
94
+ end
95
+
96
+ def recursive_verbose ( verbose )
97
+ recursive_verbose = recursive_verbose? ( verbose )
98
+ self . verbose = verbose if recursive_verbose
99
+
100
+ ret = yield
101
+
102
+ self . verbose = !verbose if recursive_verbose
103
+
104
+ ret
105
+ end
106
+
90
107
def include? ( mod )
91
108
!to_a . assoc ( mod ) . nil?
92
109
end
@@ -156,16 +173,15 @@ def require(*args) ModWhich.require(*args) end
156
173
157
174
abort usage if help || ARGV . empty?
158
175
159
- ModWhich . verbose = verbose
160
176
ModWhich . init ( ARGV , recursive )
161
177
162
- ARGV . each { |mod | require mod }
178
+ ARGV . each { |mod | require mod , verbose }
163
179
else
164
180
ModWhich . init
165
181
end
166
182
167
183
at_exit {
168
184
ModWhich . each { |mod , path |
169
185
warn "require '#{ mod } ' => #{ path || 'NOT FOUND' } "
170
- } unless ModWhich . verbose?
186
+ } unless verbose || ModWhich . verbose?
171
187
}
0 commit comments