1
0
Fork 0
mirror of https://github.com/pry/pry-rails.git synced 2022-11-09 12:36:03 -05:00

Add grep option with coloring

This commit is contained in:
Trey Lawrence 2012-07-16 01:44:49 -04:00
parent 78113e6a32
commit b9736ea4f7

View file

@ -61,6 +61,8 @@ module PryRails
show-models displays the current Rails app's models.
USAGE
opt.on :G, "grep", "Filter output by regular expression", :argument => true
end
def process
@ -69,6 +71,8 @@ module PryRails
mod.to_s + "\n" + mod.columns.map { |col| " #{col.name}: #{col.type.to_s}" }.join("\n")
end.join("\n")
models.gsub!(Regexp.new(opts[:G] || ".", Regexp::IGNORECASE)) { |s| text.red(s) }
output.puts models
end
end