All Projects → AmyrAhmady → cpp-indicators

AmyrAhmady / cpp-indicators

Licence: MIT license
A very simple, easy-to-use, and single-header-only C++ library for console based indicators (loading spinners)

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to cpp-indicators

spinnies
Node.js module to create and manage multiple spinners in command-line interface programs
Stars: ✭ 111 (+753.85%)
Mutual labels:  console, spinner, loading, loading-spinner
Spinners React
Lightweight SVG/CSS spinners for React
Stars: ✭ 254 (+1853.85%)
Mutual labels:  spinner, loading, loading-spinner
busy-load
A flexible loading-mask jQuery-plugin
Stars: ✭ 76 (+484.62%)
Mutual labels:  spinner, loading, loading-spinner
respinner
Pretty and customizable svg spinners for React.js
Stars: ✭ 89 (+584.62%)
Mutual labels:  spinner, loading, loading-spinner
Whirl
CSS loading animations with minimal effort!
Stars: ✭ 774 (+5853.85%)
Mutual labels:  spinner, loading, loading-spinner
Vue Element Loading
⏳ Loading inside a container or full screen for Vue.js
Stars: ✭ 234 (+1700%)
Mutual labels:  spinner, loading
Yaspin
A lightweight terminal spinner for Python with safe pipes and redirects 🎁
Stars: ✭ 413 (+3076.92%)
Mutual labels:  console, spinner
Yurnalist
An elegant console reporter, borrowed from Yarn
Stars: ✭ 88 (+576.92%)
Mutual labels:  console, spinner
loading
Laravel package to add loading indicator to pages while page is loading.
Stars: ✭ 38 (+192.31%)
Mutual labels:  spinner, loading-spinner
Vue Full Loading
Full overlay loading with spinner for Vue
Stars: ✭ 148 (+1038.46%)
Mutual labels:  spinner, loading
Php Console Spinner
Colorful highly configurable spinner for php cli applications (suitable for async apps)
Stars: ✭ 225 (+1630.77%)
Mutual labels:  console, spinner
ZXLoadingView
🍕ZXLoadingView is an iOS progress-activity
Stars: ✭ 14 (+7.69%)
Mutual labels:  spinner, loading
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (+1230.77%)
Mutual labels:  spinner, loading
Listr2
NodeJS Task List derived from the best! Create beautiful CLI interfaces via easy and logical to implement task lists that feel alive and interactive.
Stars: ✭ 73 (+461.54%)
Mutual labels:  console, loading
Vue Wait
Complex Loader and Progress Management for Vue/Vuex and Nuxt Applications
Stars: ✭ 1,869 (+14276.92%)
Mutual labels:  spinner, loading
ngx-loading-mask
Angular 5+ simple loading-mask ui component.
Stars: ✭ 22 (+69.23%)
Mutual labels:  loading, loading-spinner
SSSwiftUISpinnerButton
SSSwiftUISpinnerButton is a collection of various spinning animations for buttons in SwiftUI.
Stars: ✭ 37 (+184.62%)
Mutual labels:  loading, loading-spinner
loading-indicator
🚦 Simple and customizable command line loading indicator
Stars: ✭ 18 (+38.46%)
Mutual labels:  spinner, loading
Vue Loaders
Vue + loaders.css
Stars: ✭ 127 (+876.92%)
Mutual labels:  spinner, loading
Ng Block Ui
Block UI Loader/Spinner for Angular
Stars: ✭ 135 (+938.46%)
Mutual labels:  spinner, loading

cpp-indicators

A very simple, easy-to-use, and single-header-only C++ library for console based indicators (loading spinners)

Pre-made frames (indicator types)

Type Preview
0 ScreenShot
1 ScreenShot
2 ScreenShot
3 ScreenShot
4 ScreenShot
5 ScreenShot
6 ScreenShot

Examples

Basic usage:

#include <iostream>
#include <chrono>
#include "indicators.hpp"
using namespace std::chrono;

int main()
{
    auto spin = std::make_unique<indicator::indicator>(200ms, 0);
    spin->start();
    std::this_thread::sleep_for(std::chrono::milliseconds(5000));
    spin->stop();
    return 0;
}

Including prefix, suffix, and final message:

#include <iostream>
#include <chrono>
#include "indicators.hpp"
using namespace std::chrono;

int main()
{
    auto spin = std::make_unique<indicator::indicator>(200ms, 0, "Finished loading some data", "Process info: ", " Loading data...");
    spin->start();
    std::this_thread::sleep_for(std::chrono::milliseconds(5000));
    spin->stop();
    return 0;
}

You can decide if you want to hide the loading line after process or keep it by setting hide_on_end parameter to true or false in indicator constructor. Example:

// this hides loading line after process
auto spin = std::make_unique<indicator::indicator>(200ms, 0, "Finished loading some data", "Process info: ", " Loading data...", true);

// this keeps the loading line
auto spin = std::make_unique<indicator::indicator>(200ms, 0, "Finished loading some data", "Process info: ", " Loading data...", false);

Indicator with custom frames

std::vector<std::string> custom_indicator = 
{"aaaaa", "aaaa ", "aaa  ", "aa   ", "a    ", "     ", "aa   ", "aaa  ", "aaaa ", "aaaaa", " aaaa", "  aaa", "   aa", "    a", "     ", "   aa", "  aaa", " aaaa"};
auto spin = std::make_unique<indicator::indicator>(100ms, 0, "Final msg", "prefix", "suffix", false, custom_indicator);

Changes during the process

You can change prefix, suffix, and final message during the indicator process as well, not just on initialization. Or even changing the timer interval (delay value). Example: (it can be useful for stuff like downloading files or something that needs updating messages like pecent or speed)

auto spin = std::make_unique<indicator::indicator>(200ms, 0);
spin->start();
spin->set_suffix(" Downloading files...");
spin->set_prefix("Download info: ");
spin->set_end_msg("Okay seems like we're done");
spin->set_delay(500ms);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].