diff --git a/README.md b/README.md index 80a5e7f..5ee8bd2 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ * [Multi Progress](#multiprogress) * [Dynamic Progress](#dynamicprogress) * [Progress Spinner](#progress-spinner) +* [Decremental Progress](#decremental-progress) * [Working with Iterables](#working-with-iterables) * [Unicode Support](#unicode-support) * [Building Samples](#building-samples) @@ -626,6 +627,48 @@ int main() { } ``` +## Decremental Progress + +`indicators` allows you to easily control the progress direction, i.e., incremental or decremental progress by using `option::ProgressType`. To program a countdown progress bar, use `option::ProgressType::decremental` + +

+ +

+ +```cpp +#include +#include +#include +using namespace indicators; + +int main() { + + ProgressBar bar{option::BarWidth{50}, + option::ProgressType{ProgressType::decremental}, + option::Start{"["}, + option::Fill{"■"}, + option::Lead{"■"}, + option::Remainder{"-"}, + option::End{"]"}, + option::PostfixText{"Reverting System Restore"}, + option::ForegroundColor{Color::yellow}, + option::FontStyles{std::vector{FontStyle::bold}}}; + + // Update bar state + while (true) { + bar.tick(); + if (bar.is_completed()) + break; + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + + std::cout << termcolor::bold << termcolor::white + << "Task Failed Successfully\n" << termcolor::reset; + + return 0; +} +``` + ## Working with Iterables If you'd like to use progress bars to indicate progress while iterating over iterables, e.g., a list of numbers, this