@@ -442,35 +442,59 @@ using namespace indicators;
442
442
443
443
int main () {
444
444
445
- ProgressBar bar1{option::BarWidth{50}, option::ForegroundColor{Color::red},
446
- option::ShowElapsedTime{true}, option::ShowRemainingTime{true},
447
- option::PrefixText{"5c90d4a2d1a8: Downloading "}};
448
-
449
- ProgressBar bar2{option::BarWidth{50}, option::ForegroundColor{Color::yellow},
450
- option::ShowElapsedTime{true}, option::ShowRemainingTime{true},
451
- option::PrefixText{"22337bfd13a9: Downloading "}};
452
-
453
- ProgressBar bar3{option::BarWidth{50}, option::ForegroundColor{Color::green},
454
- option::ShowElapsedTime{true}, option::ShowRemainingTime{true},
455
- option::PrefixText{"10f26c680a34: Downloading "}};
456
-
457
- ProgressBar bar4{option::BarWidth{50}, option::ForegroundColor{Color::white},
458
- option::ShowElapsedTime{true}, option::ShowRemainingTime{true},
459
- option::PrefixText{"6364e0d7a283: Downloading "}};
460
-
461
- ProgressBar bar5{option::BarWidth{50}, option::ForegroundColor{Color::blue},
462
- option::ShowElapsedTime{true}, option::ShowRemainingTime{true},
463
- option::PrefixText{"ff1356ba118b: Downloading "}};
464
-
465
- ProgressBar bar6{option::BarWidth{50}, option::ForegroundColor{Color::cyan},
466
- option::ShowElapsedTime{true}, option::ShowRemainingTime{true},
467
- option::PrefixText{"5a17453338b4: Downloading "}};
445
+ auto bar1 = std::make_unique<ProgressBar >(option::BarWidth{50},
446
+ option::ForegroundColor{Color::red},
447
+ option::ShowElapsedTime{true},
448
+ option::ShowRemainingTime{true},
449
+ option::PrefixText{"5c90d4a2d1a8: Downloading "},
450
+ indicators::option::FontStyles{
451
+ std::vector< indicators::FontStyle > {indicators::FontStyle::bold}});
452
+
453
+ auto bar2 = std::make_unique<ProgressBar >(option::BarWidth{50},
454
+ option::ForegroundColor{Color::yellow},
455
+ option::ShowElapsedTime{true},
456
+ option::ShowRemainingTime{true},
457
+ option::PrefixText{"22337bfd13a9: Downloading "},
458
+ indicators::option::FontStyles{
459
+ std::vector< indicators::FontStyle > {indicators::FontStyle::bold}});
460
+
461
+ auto bar3 = std::make_unique<ProgressBar >(option::BarWidth{50},
462
+ option::ForegroundColor{Color::green},
463
+ option::ShowElapsedTime{true},
464
+ option::ShowRemainingTime{true},
465
+ option::PrefixText{"10f26c680a34: Downloading "},
466
+ indicators::option::FontStyles{
467
+ std::vector< indicators::FontStyle > {indicators::FontStyle::bold}});
468
+
469
+ auto bar4 = std::make_unique<ProgressBar >(option::BarWidth{50},
470
+ option::ForegroundColor{Color::white},
471
+ option::ShowElapsedTime{true},
472
+ option::ShowRemainingTime{true},
473
+ option::PrefixText{"6364e0d7a283: Downloading "},
474
+ indicators::option::FontStyles{
475
+ std::vector< indicators::FontStyle > {indicators::FontStyle::bold}});
476
+
477
+ auto bar5 = std::make_unique<ProgressBar >(option::BarWidth{50},
478
+ option::ForegroundColor{Color::blue},
479
+ option::ShowElapsedTime{true},
480
+ option::ShowRemainingTime{true},
481
+ option::PrefixText{"ff1356ba118b: Downloading "},
482
+ indicators::option::FontStyles{
483
+ std::vector< indicators::FontStyle > {indicators::FontStyle::bold}});
484
+
485
+ auto bar6 = std::make_unique<ProgressBar >(option::BarWidth{50},
486
+ option::ForegroundColor{Color::cyan},
487
+ option::ShowElapsedTime{true},
488
+ option::ShowRemainingTime{true},
489
+ option::PrefixText{"5a17453338b4: Downloading "},
490
+ indicators::option::FontStyles{
491
+ std::vector< indicators::FontStyle > {indicators::FontStyle::bold}});
468
492
469
493
std::cout << termcolor::bold << termcolor::white << "Pulling image foo: bar /baz\n";
470
494
471
495
// Construct with 3 progress bars. We'll add 3 more at a later point
472
496
DynamicProgress<ProgressBar > bars(bar1, bar2, bar3);
473
-
497
+
474
498
// Do not hide bars when completed
475
499
bars.set_option(option::HideBarWhenComplete{false});
476
500
@@ -518,7 +542,7 @@ int main() {
518
542
if (bars[ 0] .is_completed()) {
519
543
bars[ 0] .set_option(option::PrefixText{"5c90d4a2d1a8: Pull complete "});
520
544
// bar1 is completed, adding bar6
521
- auto i = bars.push_back(bar6);
545
+ auto i = bars.push_back(std::move( bar6) );
522
546
sixth_job = std::thread(job6, i);
523
547
sixth_job.join();
524
548
break;
@@ -533,7 +557,7 @@ int main() {
533
557
if (bars[ 1] .is_completed()) {
534
558
bars[ 1] .set_option(option::PrefixText{"22337bfd13a9: Pull complete "});
535
559
// bar2 is completed, adding bar5
536
- auto i = bars.push_back(bar5);
560
+ auto i = bars.push_back(std::move( bar5) );
537
561
fifth_job = std::thread(job5, i);
538
562
fifth_job.join();
539
563
break;
@@ -548,7 +572,7 @@ int main() {
548
572
if (bars[ 2] .is_completed()) {
549
573
bars[ 2] .set_option(option::PrefixText{"10f26c680a34: Pull complete "});
550
574
// bar3 is completed, adding bar4
551
- auto i = bars.push_back(bar4);
575
+ auto i = bars.push_back(std::move( bar4) );
552
576
fourth_job = std::thread(job4, i);
553
577
fourth_job.join();
554
578
break;
0 commit comments