https://github.com/sdmg15/cli-table-cpp
Pretty unicode tables for the CLI with CPP
https://github.com/sdmg15/cli-table-cpp
cli-table-cpp cmake cpp unicode
Last synced: 6 months ago
JSON representation
Pretty unicode tables for the CLI with CPP
- Host: GitHub
- URL: https://github.com/sdmg15/cli-table-cpp
- Owner: sdmg15
- License: mit
- Created: 2019-04-20T22:18:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-15T06:33:49.000Z (over 5 years ago)
- Last Synced: 2025-07-06T06:56:40.051Z (7 months ago)
- Topics: cli-table-cpp, cmake, cpp, unicode
- Language: C++
- Size: 176 KB
- Stars: 17
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# cli-table-cpp
Pretty unicode tables for the CLI with CPP
[  ](https://bintray.com/sdmg15/cliTable/cli-table-cpp/_latestVersion)
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 :smile:
Base on this [JavaScript project](https://github.com/Automattic/cli-table) .
# 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
```s
(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`.
```cpp
#include
#include "Table.hpp"
#include
// 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:


# 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.