Adapt samples

This commit is contained in:
Michał Walenciak
2024-08-03 13:57:27 +02:00
parent 13bdb4b396
commit 05ba667474

View File

@@ -4,53 +4,53 @@ using namespace indicators;
int main() { int main() {
ProgressBar bar1{option::BarWidth{50}, auto bar1 = std::make_unique<ProgressBar>(option::BarWidth{50},
option::ForegroundColor{Color::red}, option::ForegroundColor{Color::red},
option::ShowElapsedTime{true}, option::ShowElapsedTime{true},
option::ShowRemainingTime{true}, option::ShowRemainingTime{true},
option::PrefixText{"5c90d4a2d1a8: Downloading "}, option::PrefixText{"5c90d4a2d1a8: Downloading "},
indicators::option::FontStyles{ indicators::option::FontStyles{
std::vector<indicators::FontStyle>{indicators::FontStyle::bold}}}; std::vector<indicators::FontStyle>{indicators::FontStyle::bold}});
ProgressBar bar2{option::BarWidth{50}, auto bar2 = std::make_unique<ProgressBar>(option::BarWidth{50},
option::ForegroundColor{Color::yellow}, option::ForegroundColor{Color::yellow},
option::ShowElapsedTime{true}, option::ShowElapsedTime{true},
option::ShowRemainingTime{true}, option::ShowRemainingTime{true},
option::PrefixText{"22337bfd13a9: Downloading "}, option::PrefixText{"22337bfd13a9: Downloading "},
indicators::option::FontStyles{ indicators::option::FontStyles{
std::vector<indicators::FontStyle>{indicators::FontStyle::bold}}}; std::vector<indicators::FontStyle>{indicators::FontStyle::bold}});
ProgressBar bar3{option::BarWidth{50}, auto bar3 = std::make_unique<ProgressBar>(option::BarWidth{50},
option::ForegroundColor{Color::green}, option::ForegroundColor{Color::green},
option::ShowElapsedTime{true}, option::ShowElapsedTime{true},
option::ShowRemainingTime{true}, option::ShowRemainingTime{true},
option::PrefixText{"10f26c680a34: Downloading "}, option::PrefixText{"10f26c680a34: Downloading "},
indicators::option::FontStyles{ indicators::option::FontStyles{
std::vector<indicators::FontStyle>{indicators::FontStyle::bold}}}; std::vector<indicators::FontStyle>{indicators::FontStyle::bold}});
ProgressBar bar4{option::BarWidth{50}, auto bar4 = std::make_unique<ProgressBar>(option::BarWidth{50},
option::ForegroundColor{Color::white}, option::ForegroundColor{Color::white},
option::ShowElapsedTime{true}, option::ShowElapsedTime{true},
option::ShowRemainingTime{true}, option::ShowRemainingTime{true},
option::PrefixText{"6364e0d7a283: Downloading "}, option::PrefixText{"6364e0d7a283: Downloading "},
indicators::option::FontStyles{ indicators::option::FontStyles{
std::vector<indicators::FontStyle>{indicators::FontStyle::bold}}}; std::vector<indicators::FontStyle>{indicators::FontStyle::bold}});
ProgressBar bar5{option::BarWidth{50}, auto bar5 = std::make_unique<ProgressBar>(option::BarWidth{50},
option::ForegroundColor{Color::blue}, option::ForegroundColor{Color::blue},
option::ShowElapsedTime{true}, option::ShowElapsedTime{true},
option::ShowRemainingTime{true}, option::ShowRemainingTime{true},
option::PrefixText{"ff1356ba118b: Downloading "}, option::PrefixText{"ff1356ba118b: Downloading "},
indicators::option::FontStyles{ indicators::option::FontStyles{
std::vector<indicators::FontStyle>{indicators::FontStyle::bold}}}; std::vector<indicators::FontStyle>{indicators::FontStyle::bold}});
ProgressBar bar6{option::BarWidth{50}, auto bar6 = std::make_unique<ProgressBar>(option::BarWidth{50},
option::ForegroundColor{Color::cyan}, option::ForegroundColor{Color::cyan},
option::ShowElapsedTime{true}, option::ShowElapsedTime{true},
option::ShowRemainingTime{true}, option::ShowRemainingTime{true},
option::PrefixText{"5a17453338b4: Downloading "}, option::PrefixText{"5a17453338b4: Downloading "},
indicators::option::FontStyles{ indicators::option::FontStyles{
std::vector<indicators::FontStyle>{indicators::FontStyle::bold}}}; std::vector<indicators::FontStyle>{indicators::FontStyle::bold}});
std::cout << termcolor::bold << termcolor::white << "Pulling image foo:bar/baz\n"; std::cout << termcolor::bold << termcolor::white << "Pulling image foo:bar/baz\n";
@@ -101,7 +101,7 @@ int main() {
if (bars[0].is_completed()) { if (bars[0].is_completed()) {
bars[0].set_option(option::PrefixText{"5c90d4a2d1a8: Pull complete "}); bars[0].set_option(option::PrefixText{"5c90d4a2d1a8: Pull complete "});
// bar1 is completed, adding bar6 // bar1 is completed, adding bar6
auto i = bars.push_back(bar6); auto i = bars.push_back(std::move(bar6));
sixth_job = std::thread(job6, i); sixth_job = std::thread(job6, i);
sixth_job.join(); sixth_job.join();
break; break;
@@ -116,7 +116,7 @@ int main() {
if (bars[1].is_completed()) { if (bars[1].is_completed()) {
bars[1].set_option(option::PrefixText{"22337bfd13a9: Pull complete "}); bars[1].set_option(option::PrefixText{"22337bfd13a9: Pull complete "});
// bar2 is completed, adding bar5 // bar2 is completed, adding bar5
auto i = bars.push_back(bar5); auto i = bars.push_back(std::move(bar5));
fifth_job = std::thread(job5, i); fifth_job = std::thread(job5, i);
fifth_job.join(); fifth_job.join();
break; break;
@@ -131,7 +131,7 @@ int main() {
if (bars[2].is_completed()) { if (bars[2].is_completed()) {
bars[2].set_option(option::PrefixText{"10f26c680a34: Pull complete "}); bars[2].set_option(option::PrefixText{"10f26c680a34: Pull complete "});
// bar3 is completed, adding bar4 // bar3 is completed, adding bar4
auto i = bars.push_back(bar4); auto i = bars.push_back(std::move(bar4));
fourth_job = std::thread(job4, i); fourth_job = std::thread(job4, i);
fourth_job.join(); fourth_job.join();
break; break;