Minor updates to demo sample

This commit is contained in:
Pranav Srinivas Kumar
2019-12-04 14:45:59 -06:00
parent 4912cbbde7
commit 97311f3b6a

View File

@@ -238,18 +238,21 @@ int main() {
std::cout << "Compiling code\n"; std::cout << "Compiling code\n";
{ {
indicator::ProgressSpinner p; indicator::ProgressSpinner p;
p.set_prefix_text("- "); p.set_prefix_text(" - ");
p.set_postfix_text("Checking project dependencies"); p.set_postfix_text("Checking project dependencies");
p.set_foreground_color(indicator::Color::WHITE); p.set_foreground_color(indicator::Color::WHITE);
p.set_spinner_states({"", "", "", ""}); p.set_spinner_states({"", "", "", ""});
p.hide_percentage();
auto job = [&p]() { auto job = [&p]() {
while (true) { while (true) {
if (p.is_completed()) { if (p.current() + 1 == 100) {
break; p.set_prefix_text(" - ✔");
p.hide_spinner();
} }
else
p.tick(); p.tick();
std::this_thread::sleep_for(std::chrono::milliseconds(60)); if (p.is_completed())
break;
std::this_thread::sleep_for(std::chrono::milliseconds(30));
} }
}; };
std::thread thread(job); std::thread thread(job);