Minor API updates

This commit is contained in:
Pranav Srinivas Kumar
2019-12-04 07:56:57 -06:00
parent 94ee778cbd
commit c31e341558
2 changed files with 15 additions and 15 deletions

View File

@@ -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;