mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
Updates to progress bar API
This commit is contained in:
27
test/bar.cpp
Normal file
27
test/bar.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#include <progress/bar.hpp>
|
||||
|
||||
int main() {
|
||||
ProgressBar bar;
|
||||
|
||||
// Configure progress bar
|
||||
bar.bar_width(100);
|
||||
bar.start_with("[");
|
||||
bar.fill_progress_with("=");
|
||||
bar.lead_progress_with(">");
|
||||
bar.fill_remainder_with(" ");
|
||||
bar.end_with("]");
|
||||
|
||||
// As configured, the bar will look like this:
|
||||
//
|
||||
// [=================> ] 70%
|
||||
//
|
||||
//
|
||||
|
||||
for (size_t i = 0; i < 101; i += 5) {
|
||||
bar.set_progress(i);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user