Python library to generate sparklines ▁▂▄▅▇█ in your shell based upon
relative ordering of data. lehar
is a Hindi word which means
wave. lehar
can be invoked via commandline also.
# Find commits by authors in a git repo
$ git shortlog -s | cut -f1 | lehar
▇▁▁▁▁▁▁▂▃▁▁█▁▁▂▃▅▁▁▁▂▆▁▁▁▂▁▁▁▁▂▇▁▅▆▁▁▁▄▁▁█▁▁▂▁▂▁
Using homebrew
:
$ brew install lehar
Using pip
$ pip install lehar
gi
type
: list
Only supported option is
color
eg.
color='red'
>>> import lehar
# Strings
>>> lehar.draw(["0","1","2","3","4"])
'▁▂▄▆█'
# Numbers
>>> lehar.draw([0,1,2,3,4])
'▁▂▄▆█'
# Negatives
>>> lehar.draw([1,3,-34,12,44,81,0])
'▃▃▁▄▆█▃'
# Missing data
>>> lehar.draw([1,3,-34,'',12,44,'',81,0])
'▃▃▁ ▄▆ █▃'
>>> lehar.draw(["0","1","2","3","4"],color="yellow")
>>> lehar.draw([1,3,-34,'',12,44,'',81,0],color="cyan")
$ lehar 1 2 3 4 5
$ lehar -c red 1 2 3 4 5
$ echo "-c cyan 1 2 3 4 5" | lehar
$ lehar < input
lehar
supports both Python2
& Python3
.
Setup
$ git clone https://github.com/darxtrix/lehar $ cd lehar $ pip install -r requirements.txt $ python setup.py develop $ lehar
Tests are located at
lehar/tests.py
and covergae tests are located at.travis.yml
$ python tests.py
While sending a pull request increment the version at VERSION and make sure the travis build passes.
MIT © [Ankush Sharma](http://github.com/darxtrix)