Skip to content

Instantly share code, notes, and snippets.

@no6v
Created May 20, 2012 05:08
Show Gist options
  • Save no6v/2749548 to your computer and use it in GitHub Desktop.
Save no6v/2749548 to your computer and use it in GitHub Desktop.
Earthquake.init do
command :history_cleaner do |m|
re = Regexp.new(m[1])
to_be_removed = []
Readline::HISTORY.each_with_index do |entry, index|
if re === entry
puts "to be removed: #{entry}"
to_be_removed << index
end
end
if confirm("ok?", :y)
to_be_removed.reverse_each do |index|
Readline::HISTORY.delete_at(index)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment