pp
pp copied to clipboard
Add a simple way to use colours, for individual keys
pp is great.
Sometimes you have a large datastructure, a hash, and it is hard to see which entries belong where to.
For instance I had:
:files=>
"/home/x/data/personal_2_bis_6.pdf",
"/home/x/data/personal2010_Scan.pdf",
"/home/x/data/personalfoo_8.pdf"],
:directories=>
["/home/x/data/personal/one/",
"/home/x/data/personal/two",
"/home/x/data/personal/three",
The real data was much longer.
I'd like to see the keys :files and :directories in another colour, such as blue and green.
These colours should a) have a default, and b) can be customized by the user.
This is for terminal display.
And, the API for this should be simple.
Such as:
pp hash, :default_colours
Or:
Pp.use_default_colours # and then pp
And it should be documented somewhere, ideally here on github too with usage example code.