Project

redundancy

0.0
No release in over a year
Redundancy is a Ruby program that loads the .zsh_history, .bash_history, .irb_history files, and applies the built-in Ruby uniq! function to trim any duplicate commands present. It then writes the filtered output back to the appropriate file. The source code works better as an Apple Shortcut, as there is a significant delay running redundancy when Terminal is open (several closings and reopenings).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Redundancy

Gem Version

Redundancy is a RubyGem that loads the .zsh_history, .bash_history, .irb_history files, and applies the built-in Ruby uniq! function to trim any duplicate commands present. It then writes the filtered output back to the appropriate file.

Install

Install the gem with:

gem install redundancy

Or add to your Gemfile:

gem "redundancy"

Usage

You simply need to call the gem by name. The effects of the command execution will not be seen until you restart terminal:

redundancy

Source Code

#!/usr/bin/env ruby
$stdin.flush
$stdout.flush
$stdout.sync = true

arr = ["/.bash_history", "/.irb_history", "/.zsh_history"]

for i in arr do
    l = Dir.home + i
    e = File.readlines(l)
    e.uniq!
    f = File.open(l, "w")

    e.each do |line|
        f.puts(line)
    end
    f.close
end

Apple Shortcuts

The source code works better as an Apple Shortcut, as there is a significant delay running redundancy when Terminal is open (several closings and reopenings).

Apple

License

Code is distributed under The Unlicense and is part of the Public Domain.