Library with useful output stream tools like: color and style manipulators, progress bars and terminal graphics
Table of contents
Introduction
Here I want to present you osmanip: a C++ library containing useful tools to customize the output stream of your programs. Within this tools you can manipulate an output stream with colors, styles (ex: bold, italics, etc...) and manage other tools like progress bars and terminal graphics. You can also manipulate ANSI escape sequences / codes, with proper functions provided by the library. Using this features may be very useful to better read error messages or special information you want to be sure other users see when they run your code, or to adorn your general output stream log.
If you want to use this software in one of your project, please cite it. You can find the citation template here.
NOTE: all the manipulators of this library are compatible with iomanip.
NOTE 2: this library doesn't make use of any GUI.
Example output of the main.cpp program demo:
Colors and styles manipulators
Progress bars
2D terminal-graphics
The software is and will stay free, but if you want to support me with a donation it would be really appreciated!
Supported and tested operating systems:
- Ubuntu (and the other Linux OSs).
- Windows Subsystem for Linux (WSL).
Documentation
In the doc folder useful documentation files are stored, in order to help the user learning how to properly use the library:
- Code structure: contains general information about the code structure of the library, therefore details on classes, functions and variables used in it.
- Download and install: a guide to download, install and run the library into your system.
- Contributing: if you want to contribute to the development of this library or you want to raise an issue, please carefully read this document before.
- Todo: contains a list of future implementations of the library.
- How-to-use guides: contains a set of guides about how to use the library tools.
Repository structure
osmanip/
├── img/
├── doc/
│ ├── Code structure.md
│ ├── Contributing.md
│ ├── Download and install.md
│ ├── Todo.md
│ ├── How-to-use guides.md
├── include/
│ ├── graphics/
│ │ ├── canvas.hpp
│ │ ├── plot_2D.hpp
│ ├── manipulators/
│ │ ├── csmanip.hpp
│ ├── progressbar/
│ │ ├── progress_bar.hpp
│ │ ├── multi_progress_bar.hpp
├── src/
│ ├── graphics/
│ │ ├── canvas.cpp
│ │ ├── plot_2D.cpp
│ ├── manipulators/
│ │ ├── csmanip.cpp
│ ├── progressbar/
│ │ ├── progress_bar.cpp
│ │ ├── multi_progress_bar.cpp
│ ├── main.cpp
├── scripts/
│ ├── debug.sh
│ ├── install.sh
│ ├── uninstall.sh
│ ├── update.sh
│ ├── size_of_dir.sh
├── test/
│ ├── graphics/
│ │ ├── tests_canvas.cpp
│ │ ├── tests_plot_2D.cpp
│ ├── manipulators/
│ │ ├── tests_csmanip.cpp
│ ├── progressbar/
│ │ ├── tests_progress_bar.cpp
│ │ ├── tests_multi_progress_bar.cpp
│── README.md
│── License
│── CITATION.cff
│── Makefile
│── .gitignore
│── .clang-format
│── .valgrindrc
│── .gitignore
│── .all-contributorsrc
News from the last version
Most recent relevant news from the last version:
- A new feature to plot 2D graphics and functions in the terminal has been added. See here.
- Progress spinner has been added to the
ProgressBar
class. - New features have been added to the progress bar: time-reamining info.
- Added a new map for the
feat
function to deal with clear screen / line commands. - Added a new
print
function inspired by the Python one.
List of features
Here you can find the list of features implemented in the current version of the library:
- Output stream manipulators for:
- Color and style manipulation
- Cursor navigation
- Terminal control sequences
- Additional functions (like an own version of the Python print one).
- Progress indicators:
- Terminal graphics:
Why choosing this library for color / styles / escape sequences manipulation:
- All the functions used to manipulate these sequences are very easy to use and don't require complex code signatures.
- All the most common ANSI sequences can be manipulated.
Why choosing this library for progress bars? Some properties:
- Extremely easy to use.
- Compatible with positive or negative variable of any standard type (integer, float, double and others).
- Maximum and minimum values can be set with any value you prefer and the progress bars will be self-built with respect to them.
- Each progress bar feature can be fully customized (messages, style, color, brackets type, time remaining info etc...) regarding to your requirements. You can also choose to use only a progress indicator or a loading bar instead of a complete progress bar.
- It is thread-safe, hence you can use also multiple progress bars simultaneously.
Why choosing this library for terminal graphics:
- There are very few C++ libraries doing this job, and this is one of them.
- High level of customizability.
- A faster and most comfortable alternative to plot simple functions without the needing of GUI.
Credits
Project leaders
Gianluca Bianco |
Other contributors
MiguelMJ |
Ted Lyngmo |
myermo |
nick-botticelli |