Sparkr is a port of spark for Ruby.
It lets you create ASCII sparklines for your Ruby CLIs: ▁▂▃▅▇
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install sparkr
After installation, just run
sparkr and pass it a list of numbers, like
you would with spark. The output is what
you would expect:
$ sparkr 0 30 55 80 33 150 ▁▂▃▅▂▇
The real reason for this port:
Sparkr.sparkline([0,30,55,80,33,150]) # => "▁▂▃▅▂▇"
Let's say you have your list of open and closed issues.
list = [open_issue_count, closed_issue_count] Sparkr.sparkline(list) # => "▁█"
But now you want to format the sparkline so that the open issues are red and the closed ones are green (to quickly see how you are doing).
Let's further suppose you use a gem that adds a
#color method to
for ANSI coloring, like
Sparkr.sparkline(list) do |tick, count, index| if index == 0 tick.color(:red) else tick.color(:green) end end # => "▁█" (colored, trust me)
To see how this looks live and in full colour, take a look at Inch.
git checkout -b my-new-feature)
git commit -am 'Add some feature')
git push origin my-new-feature)
René Föhring (@rrrene)
Sparkr would not exist without Zach Holman's spark.
Sparkr is released under the MIT License. See the LICENSE.txt file for further details.