From 97311f3b6a448d901f5aa4deb65970325e38e852 Mon Sep 17 00:00:00 2001 From: Pranav Srinivas Kumar Date: Wed, 4 Dec 2019 14:45:59 -0600 Subject: [PATCH] Minor updates to demo sample --- samples/multiple_bars.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/samples/multiple_bars.cpp b/samples/multiple_bars.cpp index 635f56e..633742c 100644 --- a/samples/multiple_bars.cpp +++ b/samples/multiple_bars.cpp @@ -238,18 +238,21 @@ int main() { std::cout << "Compiling code\n"; { indicator::ProgressSpinner p; - p.set_prefix_text("- "); + p.set_prefix_text(" - "); p.set_postfix_text("Checking project dependencies"); p.set_foreground_color(indicator::Color::WHITE); p.set_spinner_states({"▖", "▘", "▝", "▗"}); + p.hide_percentage(); auto job = [&p]() { while (true) { - if (p.is_completed()) { - break; + if (p.current() + 1 == 100) { + p.set_prefix_text(" - ✔"); + p.hide_spinner(); } - else - p.tick(); - std::this_thread::sleep_for(std::chrono::milliseconds(60)); + p.tick(); + if (p.is_completed()) + break; + std::this_thread::sleep_for(std::chrono::milliseconds(30)); } }; std::thread thread(job);