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:
parent
78113e6a32
commit
b9736ea4f7
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue