mdk97 / mktable

Generates a ASCII art table from a text file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mktable

Generates a text-based table from a CSV file

Example

Suppose we have a .csv file with the following syntax:

Name;Sex;Age;Height(in);Weight(lbs)
Alex;M;41;74;170
Bert;M;42;68;166
Carl;M;32;70;155
Dave;M;39;72;167
Elly;F;30;66;124
Fran;F;33;66;115
Gwen;F;26;64;121
Hank;M;30;71;158
Ivan;M;53;72;175
Jake;M;32;69;143
Kate;F;47;69;139
Luke;M;34;72;163
Myra;F;23;62;98
Neil;M;36;75;160
Omar;M;38;70;145
Page;F;31;67;135
Quin;M;29;71;176
Ruth;F;28;65;131

For this file, mktable will generate the following table:
┌─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐
│    Name     │     Sex     │     Age     │ Height(in)  │ Weight(lbs) │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Alex     │      M      │     41      │     74      │     170     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Bert     │      M      │     42      │     68      │     166     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Carl     │      M      │     32      │     70      │     155     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Dave     │      M      │     39      │     72      │     167     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Elly     │      F      │     30      │     66      │     124     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Fran     │      F      │     33      │     66      │     115     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Gwen     │      F      │     26      │     64      │     121     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Hank     │      M      │     30      │     71      │     158     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Ivan     │      M      │     53      │     72      │     175     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Jake     │      M      │     32      │     69      │     143     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Kate     │      F      │     47      │     69      │     139     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Luke     │      M      │     34      │     72      │     163     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Myra     │      F      │     23      │     62      │     98      │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Neil     │      M      │     36      │     75      │     160     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Omar     │      M      │     38      │     70      │     145     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Page     │      F      │     31      │     67      │     135     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Quin     │      M      │     29      │     71      │     176     │
├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│    Ruth     │      F      │     28      │     65      │     131     │
└─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘

Important Notes

I use the Rainbow library to print colored text, so don't forget to git submodule update --init after cloning this repository.

Building the project

You just need to execute make to compile the source code, which will generate the mktable executable.

About

Generates a ASCII art table from a text file

License:Do What The F*ck You Want To Public License


Languages

Language:C++ 98.6%Language:Makefile 1.4%