mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-12 01:18:52 +08:00
Renamed project to indica
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <indicator/termcolor.hpp>
|
#include <indica/termcolor.hpp>
|
||||||
|
|
||||||
namespace indicator {
|
namespace indica {
|
||||||
enum class Color { GREY, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE };
|
enum class Color { GREY, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE };
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <indicator/color.hpp>
|
#include <indica/color.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
namespace indicator {
|
namespace indica {
|
||||||
|
|
||||||
class ProgressBar {
|
class ProgressBar {
|
||||||
public:
|
public:
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <indicator/color.hpp>
|
#include <indica/color.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace indicator {
|
namespace indica {
|
||||||
|
|
||||||
class ProgressSpinner {
|
class ProgressSpinner {
|
||||||
public:
|
public:
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <indicator/progress_bar.hpp>
|
#include <indica/progress_bar.hpp>
|
||||||
#include <indicator/progress_spinner.hpp>
|
#include <indica/progress_spinner.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -48,14 +48,14 @@ int main() {
|
|||||||
//
|
//
|
||||||
// PROGRESS BAR 1
|
// PROGRESS BAR 1
|
||||||
//
|
//
|
||||||
indicator::ProgressBar p1;
|
indica::ProgressBar p1;
|
||||||
p1.set_bar_width(50);
|
p1.set_bar_width(50);
|
||||||
p1.start_bar_with("[");
|
p1.start_bar_with("[");
|
||||||
p1.fill_bar_progress_with("■");
|
p1.fill_bar_progress_with("■");
|
||||||
p1.lead_bar_progress_with("■");
|
p1.lead_bar_progress_with("■");
|
||||||
p1.fill_bar_remainder_with(" ");
|
p1.fill_bar_remainder_with(" ");
|
||||||
p1.end_bar_with("]");
|
p1.end_bar_with("]");
|
||||||
p1.set_foreground_color(indicator::Color::YELLOW);
|
p1.set_foreground_color(indica::Color::YELLOW);
|
||||||
|
|
||||||
std::atomic<size_t> index1{0};
|
std::atomic<size_t> index1{0};
|
||||||
std::vector<std::string> status_text1 = {"Rocket.exe is not responding",
|
std::vector<std::string> status_text1 = {"Rocket.exe is not responding",
|
||||||
@@ -84,7 +84,7 @@ int main() {
|
|||||||
//
|
//
|
||||||
// PROGRESS BAR 3
|
// PROGRESS BAR 3
|
||||||
//
|
//
|
||||||
indicator::ProgressBar p3;
|
indica::ProgressBar p3;
|
||||||
p3.set_bar_width(40);
|
p3.set_bar_width(40);
|
||||||
p3.set_prefix_text("Reading package list... ");
|
p3.set_prefix_text("Reading package list... ");
|
||||||
p3.start_bar_with("");
|
p3.start_bar_with("");
|
||||||
@@ -92,7 +92,7 @@ int main() {
|
|||||||
p3.lead_bar_progress_with("");
|
p3.lead_bar_progress_with("");
|
||||||
p3.fill_bar_remainder_with("");
|
p3.fill_bar_remainder_with("");
|
||||||
p3.end_bar_with("");
|
p3.end_bar_with("");
|
||||||
p3.set_foreground_color(indicator::Color::WHITE);
|
p3.set_foreground_color(indica::Color::WHITE);
|
||||||
p3.hide_percentage();
|
p3.hide_percentage();
|
||||||
auto job3 = [&p3]() {
|
auto job3 = [&p3]() {
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -112,7 +112,7 @@ int main() {
|
|||||||
//
|
//
|
||||||
// PROGRESS BAR 2
|
// PROGRESS BAR 2
|
||||||
//
|
//
|
||||||
indicator::ProgressBar p2;
|
indica::ProgressBar p2;
|
||||||
p2.set_bar_width(50);
|
p2.set_bar_width(50);
|
||||||
p2.start_bar_with("[");
|
p2.start_bar_with("[");
|
||||||
p2.fill_bar_progress_with("=");
|
p2.fill_bar_progress_with("=");
|
||||||
@@ -120,7 +120,7 @@ int main() {
|
|||||||
p2.fill_bar_remainder_with(" ");
|
p2.fill_bar_remainder_with(" ");
|
||||||
p2.end_bar_with("]");
|
p2.end_bar_with("]");
|
||||||
p2.set_postfix_text("Getting started");
|
p2.set_postfix_text("Getting started");
|
||||||
p2.set_foreground_color(indicator::Color::GREEN);
|
p2.set_foreground_color(indica::Color::GREEN);
|
||||||
auto job2 = [&p2]() {
|
auto job2 = [&p2]() {
|
||||||
while (true) {
|
while (true) {
|
||||||
auto ticks = p2.current();
|
auto ticks = p2.current();
|
||||||
@@ -145,14 +145,14 @@ int main() {
|
|||||||
// PROGRESS BAR 4
|
// PROGRESS BAR 4
|
||||||
//
|
//
|
||||||
std::vector<std::string> lead_spinner{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"};
|
std::vector<std::string> lead_spinner{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"};
|
||||||
indicator::ProgressBar p4;
|
indica::ProgressBar p4;
|
||||||
p4.set_bar_width(50);
|
p4.set_bar_width(50);
|
||||||
p4.start_bar_with("");
|
p4.start_bar_with("");
|
||||||
p4.fill_bar_progress_with("⠸");
|
p4.fill_bar_progress_with("⠸");
|
||||||
p4.lead_bar_progress_with("");
|
p4.lead_bar_progress_with("");
|
||||||
p4.fill_bar_remainder_with(" ");
|
p4.fill_bar_remainder_with(" ");
|
||||||
p4.end_bar_with("");
|
p4.end_bar_with("");
|
||||||
p4.set_foreground_color(indicator::Color::CYAN);
|
p4.set_foreground_color(indica::Color::CYAN);
|
||||||
p4.set_postfix_text("Restoring system state");
|
p4.set_postfix_text("Restoring system state");
|
||||||
p4.hide_percentage();
|
p4.hide_percentage();
|
||||||
std::atomic<size_t> index4{0};
|
std::atomic<size_t> index4{0};
|
||||||
@@ -163,7 +163,7 @@ int main() {
|
|||||||
index4 += 1;
|
index4 += 1;
|
||||||
if (p4.current() + 2 >= 100) {
|
if (p4.current() + 2 >= 100) {
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
p4.set_foreground_color(indicator::Color::RED);
|
p4.set_foreground_color(indica::Color::RED);
|
||||||
p4.set_prefix_text("{ ERROR } ");
|
p4.set_prefix_text("{ ERROR } ");
|
||||||
p4.show_percentage();
|
p4.show_percentage();
|
||||||
p4.set_postfix_text("Failed to restore system");
|
p4.set_postfix_text("Failed to restore system");
|
||||||
@@ -183,7 +183,7 @@ int main() {
|
|||||||
//
|
//
|
||||||
// GOING BACKWARDS
|
// GOING BACKWARDS
|
||||||
//
|
//
|
||||||
indicator::ProgressBar p;
|
indica::ProgressBar p;
|
||||||
p.set_bar_width(50);
|
p.set_bar_width(50);
|
||||||
p.start_bar_with("[");
|
p.start_bar_with("[");
|
||||||
p.fill_bar_progress_with("■");
|
p.fill_bar_progress_with("■");
|
||||||
@@ -191,7 +191,7 @@ int main() {
|
|||||||
p.fill_bar_remainder_with("-");
|
p.fill_bar_remainder_with("-");
|
||||||
p.end_bar_with("]");
|
p.end_bar_with("]");
|
||||||
p.set_progress(100);
|
p.set_progress(100);
|
||||||
p.set_foreground_color(indicator::Color::WHITE);
|
p.set_foreground_color(indica::Color::WHITE);
|
||||||
p.set_postfix_text("Reverting system restore");
|
p.set_postfix_text("Reverting system restore");
|
||||||
std::atomic<size_t> progress{100};
|
std::atomic<size_t> progress{100};
|
||||||
auto job = [&p, &progress]() {
|
auto job = [&p, &progress]() {
|
||||||
@@ -211,14 +211,14 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
indicator::ProgressSpinner p;
|
indica::ProgressSpinner p;
|
||||||
p.set_postfix_text("Checking credentials");
|
p.set_postfix_text("Checking credentials");
|
||||||
p.set_foreground_color(indicator::Color::YELLOW);
|
p.set_foreground_color(indica::Color::YELLOW);
|
||||||
p.set_spinner_states({"⠈", "⠐", "⠠", "⢀", "⡀", "⠄", "⠂", "⠁"});
|
p.set_spinner_states({"⠈", "⠐", "⠠", "⢀", "⡀", "⠄", "⠂", "⠁"});
|
||||||
auto job = [&p]() {
|
auto job = [&p]() {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (p.is_completed()) {
|
if (p.is_completed()) {
|
||||||
p.set_foreground_color(indicator::Color::GREEN);
|
p.set_foreground_color(indica::Color::GREEN);
|
||||||
p.set_prefix_text("✔");
|
p.set_prefix_text("✔");
|
||||||
p.hide_spinner();
|
p.hide_spinner();
|
||||||
p.hide_percentage();
|
p.hide_percentage();
|
||||||
@@ -237,10 +237,10 @@ int main() {
|
|||||||
|
|
||||||
std::cout << "Compiling mission\n";
|
std::cout << "Compiling mission\n";
|
||||||
{
|
{
|
||||||
indicator::ProgressSpinner p;
|
indica::ProgressSpinner p;
|
||||||
p.set_prefix_text(" - ");
|
p.set_prefix_text(" - ");
|
||||||
p.set_postfix_text("Searching for planet");
|
p.set_postfix_text("Searching for planet");
|
||||||
p.set_foreground_color(indicator::Color::WHITE);
|
p.set_foreground_color(indica::Color::WHITE);
|
||||||
p.set_spinner_states({"▖", "▘", "▝", "▗"});
|
p.set_spinner_states({"▖", "▘", "▝", "▗"});
|
||||||
p.hide_percentage();
|
p.hide_percentage();
|
||||||
auto job = [&p]() {
|
auto job = [&p]() {
|
||||||
|
|||||||
Reference in New Issue
Block a user