sparky
I have played with the idea of displaying statistics about version control systems in a Unix shell, and I also wanted to improve my command line skills.
Before starting, I remembered spark, a project that generates sparklines for a set of data, so I became interested in trying an alternative Groovy implementation to have fun.
Sparklines for your shell: Groovy flavored
My project is sparky, a Groovy script that lets you graph tiny sparkline graphs from your command line.
sparky takes a list of numbers—comma-delimited or spaces—and then prints a sparkline out of it. It’s designed to be used in conjunction with other scripts that can output in that format.
$ sparky 1 5 22 13 53
▁▁▃▂▇
$ sparky 0,30,55,80,33,150
▁▂▃▅▂▇
$ echo 9 13 5 17 1 | sparky
▄▆▂█▁
Practical examples
There are many possibilities. Here are two examples.
Number of commits to the groovy-core Git repository, by author:
$ git shortlog -s |
> awk '{print $1}' |
> sparky
▁▁▁▁▁▁▁▁▁▁▁▃▁▁▁▁▁▁▁▁▁▁▁▁▂▁▁▄▁▁▁▁▁▁▁▅▁▁▁▁▁▁▁▁▁▁▁▁█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
Code visualization. The number of characters of sparky
itself, by line, ignoring empty lines:
$ awk '{ print length($0) }' sparky |
> grep -v ^0$ |
> sparky
▂▂▁▁▃▁▃▂▃▃▃▂▁▁▂▄▁▄▅▅█▅▂▁▁▃▃▅▁▁▃▂▁▁▇▃▁
Try it!
June 17, 2012 | @ArturoHerrero