mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
Minor API updates
This commit is contained in:
@@ -15,7 +15,7 @@ int main() {
|
||||
p1.fill_progress_with("■");
|
||||
p1.lead_progress_with("■");
|
||||
p1.fill_remainder_with(" ");
|
||||
p1.end_with(" ]");
|
||||
p1.end_with("]");
|
||||
p1.color(ProgressBar::Color::YELLOW);
|
||||
|
||||
std::atomic<size_t> index1{0};
|
||||
@@ -36,7 +36,7 @@ int main() {
|
||||
while (true) {
|
||||
if (p1.completed())
|
||||
break;
|
||||
p1.append_text(status_text1[index1 % status_text1.size()]);
|
||||
p1.set_status_text(status_text1[index1 % status_text1.size()]);
|
||||
p1.set_progress(index1 * 10);
|
||||
index1 += 1;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(600));
|
||||
@@ -55,19 +55,19 @@ int main() {
|
||||
p2.lead_progress_with(">");
|
||||
p2.fill_remainder_with(" ");
|
||||
p2.end_with("]");
|
||||
p2.append_text("Getting started");
|
||||
p2.set_status_text("Getting started");
|
||||
p2.color(ProgressBar::Color::GREEN);
|
||||
auto job2 = [&p2]() {
|
||||
while (true) {
|
||||
auto ticks = p2.current();
|
||||
if (ticks > 20 && ticks < 50)
|
||||
p2.append_text("Delaying the inevitable");
|
||||
p2.set_status_text("Delaying the inevitable");
|
||||
else if (ticks > 50 && ticks < 80)
|
||||
p2.append_text("Crying quietly");
|
||||
p2.set_status_text("Crying quietly");
|
||||
else if (ticks > 80 && ticks < 98)
|
||||
p2.append_text("Almost there");
|
||||
p2.set_status_text("Almost there");
|
||||
else if (ticks >= 98)
|
||||
p2.append_text("Done");
|
||||
p2.set_status_text("Done");
|
||||
p2.tick();
|
||||
if (p2.completed())
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user