mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
Updated samples/demos to show usage of hide/show time elapsed/remaining
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
#include <chrono>
|
||||
#include <indicators/block_progress_bar.hpp>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
int main() {
|
||||
|
||||
// Hide cursor
|
||||
std::cout << "\e[?25l";
|
||||
|
||||
|
||||
indicators::BlockProgressBar bar;
|
||||
|
||||
|
||||
// Configure the bar
|
||||
bar.set_bar_width(80);
|
||||
bar.start_bar_with("[");
|
||||
bar.end_bar_with("]");
|
||||
bar.set_foreground_color(indicators::Color::WHITE);
|
||||
|
||||
bar.set_foreground_color(indicators::Color::WHITE);
|
||||
bar.hide_elapsed_time();
|
||||
bar.hide_remaining_time();
|
||||
|
||||
// Update bar state
|
||||
auto progress = 0.0f;
|
||||
while (true) {
|
||||
@@ -26,7 +28,7 @@ int main() {
|
||||
}
|
||||
|
||||
// Show cursor
|
||||
std::cout << "\e[?25h";
|
||||
std::cout << "\e[?25h";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user