Skip to content

Latest commit

 

History

History
86 lines (57 loc) · 2.46 KB

README.md

File metadata and controls

86 lines (57 loc) · 2.46 KB

cli-table-cpp

Pretty unicode tables for the CLI with CPP

Download

I was looking for a simple and beautiful unicode table for the CLI for a toy project written in C++ but didn't found one that satisfy my needs then I build one 😄 Base on this JavaScript project .

Compiling and Running the tests

Requirements

  • CMAKE 3.10 or greater
  • Clang or G++ 7.3.0 (That supports C++17)
  • Conan - C++ package manager

Compiling

If all requirements are met then you can build using cmake :

Then run the command according to the targetted OS

(win)
$ cmake .. -G "Visual Studio 15 Win64"
$ cmake --build . --config Release

(linux, mac)
$ cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
$ cmake --build ..

The resulting binary will be the located in the bin folder.

To run test with make

make build run clean

Basics usage

You need first to include the header files Table.hpp and Utils.hpp.

    #include <iostream>
    #include "Table.hpp"
    #include <string>

    // Options for the table to draw
    CliTable::Options opt;
    // Contructing the table structure
    TableBody content = {
                            { "value \nmultilines ?"     ,        "Nope \njust \ntesting" },
                            { "value Yes\n are you sure?" ,              "Teufy"      },
                            { "This \nis me !"         ,     "Heuh \nanother one"  },
                            { "value \nmultilines ?"     ,        "Nope \njust \ntesting" },
                            { "value Yes\n are you sure?" ,              "Teufy"      },
                        };
    // Or you can use the push_back() method 
    content.push_back( { "This \nis me !"         ,     "Heuh \nanother one"  } );

    CliTable::Table table(opt,content);
    //Generating the final table 

    table.generate();
    

Result after running binary

Here is the result in image of what you can get after running the tests or after your own customization:

Result

Result Multilines

Contributing

If you found a bug or want to add a new feature, create a new branch and work on it after when it's ready open a pull request and after reviewing the branch will be merge into the master branch.