mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-12 17:58:55 +08:00
Updated samples/demos to show usage of hide/show time elapsed/remaining
This commit is contained in:
@@ -11,31 +11,30 @@ int main() {
|
||||
bar.fill_bar_remainder_with("-");
|
||||
bar.end_bar_with("]");
|
||||
bar.set_foreground_color(indicators::Color::YELLOW);
|
||||
bar.hide_elapsed_time();
|
||||
bar.hide_remaining_time();
|
||||
|
||||
// As configured, the bar will look like this:
|
||||
//
|
||||
// [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■-------------] 70%
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
std::atomic<size_t> index{0};
|
||||
std::vector<std::string> status_text =
|
||||
{
|
||||
"Rocket.exe is not responding",
|
||||
"Finding a replacement engineer",
|
||||
"Buying more snacks",
|
||||
"Assimilating the modding community",
|
||||
"Crossing fingers",
|
||||
"Porting KSP to a Nokia 3310"
|
||||
};
|
||||
|
||||
std::vector<std::string> status_text = {"Rocket.exe is not responding",
|
||||
"Finding a replacement engineer",
|
||||
"Buying more snacks",
|
||||
"Assimilating the modding community",
|
||||
"Crossing fingers",
|
||||
"Porting KSP to a Nokia 3310"};
|
||||
|
||||
// Let's say you want to append some status text to the right of the progress bar
|
||||
// You can use bar.set_postfix_text(...) to append text to the right
|
||||
//
|
||||
// [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■-------------] 70% Finding a replacement engineer
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
auto job = [&bar, &index, &status_text]() {
|
||||
while (true) {
|
||||
@@ -58,6 +57,6 @@ int main() {
|
||||
second_job.join();
|
||||
third_job.join();
|
||||
last_job.join();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user