Introducing Text::ANSITable
Even in the good old days of DOS, we already had color tables and extended ASCII characters to draw various border styles. So why limit ourselves with something like Text::ASCIITable? Introducing Text::ANSITable to make your text tables look pretty in terminals. See pictures for some examples:
Features:
- Drawing borders with box-drawing and Unicode characters.
- Border styles. You can select and even create your own border styles. Border styles support things like custom characters, etc.
- Full color support (256 on any xterm-256color terminal emulators, and true color on Konsole/Yakuake). Graceful degradation (autoreduce colors) on terminals that do not support higher color depth.
- Color themes. You can select and even create your own color themes. Color themes support things like random/custom/gradation colors, etc.
- Wide character support. Your tables will still be aligned even if your text contains wide characters.
- ANSI support. Your tables will still be aligned even if your text contains ANSI escape codes.
- Modular and flexible formatting system for things like text wrapping, highlighting, number formatting (thousands, scientific, kilo/kibi formatting), sprintf-style formatting, etc).
- Per-column/per-row/per-cell styling
- Row/column filtering
- Column reordering.
Compared to Text::ASCIITable, Text::ANSITable uses lowercase_with_underscore for method names instead of CamelCase. I know a lot of Perl programmers, me included, prefer the former.
It's an early release so there are bound to be some quirks and bugs, but the basic features are already there. Enjoy!
I love people who love terminals :)
nice work! it seems to be helpful for my some CLI tools.
Hi, how do I get this installed in my current version of ActivePerl? It does not seem to be included and I am unable to install it by the "ppm" method either. Thanks
This happens because Proc::ProcessTable fails to install on Windows. I've modified Term::Detect::Software to only require SHARYANTO::Proc::Util (which requires Proc::ProcessTable) on certain OS's only, Windows not included.
If you use Strawberry Perl, you can already install now. On ActivePerl, perhaps wait for a day or two until the PPM build bots build the packages?
Ok, there's another issue. According to http://ppm4.activestate.com/MSWin32-x86/5.16/1600/S/SH/SHARYANTO/Text-ANSITable-0.32.d/log-20140428T031150.txt the build fails because of Data::Unixish (some failing tests). I've released a new version of Data::Unixish which solves this.
Hi again. I can install Unixish in ActivePerl but "ppm install Text-ANSITable" still doesn't work....any workarounds? Thanks
It looks like ActiveState hasn't tried rebuilding Text::ANSITable again. I've just pushed a new release that hopefully will nudge the build bots to rebuild it.
You can wait for a day or two (perhaps?) for the build bots to build a new PPM.
Or you can download http://cpan.metacpan.org/authors/id/S/SH/SHARYANTO/Text-ANSITable-0.33.tar.gz , extract it on to your computer, open Command Prompt, cd to the extracted folder, and type:
perl Makefile.PL
dmake
dmake install
Thanks Steven. The tarball compile ok in ActivePerl. I have issues in my perl console that keep saying it cannot find Log/Any.pm in @Inc and compilation aborted at the line when I load the Ansitable via "use Text::ANSITable;".
In c:\Perl64\lib\Text folder I have "ANSITable.pm".
In the c:\Perl64\lib\Text\ANSITable folder I have
"BorderStyle", "ColorTheme" and "StyleSet" folder and each of these folders contain their respective *.pm libraries.
Any ideas why Perl is making this complain?
Thanks again
You'll need to install Log::Any too (and other subsequent modules that might show up in the similar error message). It shouldn't happen though because the CPAN installer (like PPM or cpan/cpanminus) should already handle and install the dependencies for you.
It would appear Log::Any is already installed in ActivePerl but I run the ppm install method again....but I am unable to get pass the compilation error when Perl tries to load the ANSITable library....anymore suggestions?
I see that Text::ANSITable 0.33 has appeared in PPM repository. Installing it with ActivePerl should be easy now.