mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
adjust readme, demo, and examples: replace show/hide cursor calls
This commit is contained in:
committed by
Felix Gündling
parent
d99cad1ede
commit
c2beb2ac22
22
README.md
22
README.md
@@ -110,14 +110,16 @@ If you'd rather control progress of the bar in discrete steps, consider using `b
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <indicators/cursor_control.hpp>
|
||||||
#include <indicators/progress_bar.hpp>
|
#include <indicators/progress_bar.hpp>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
using namespace indicators;
|
||||||
|
|
||||||
// Hide cursor
|
// Hide cursor
|
||||||
std::cout << "\e[?25l";
|
show_console_cursor(false);
|
||||||
using namespace indicators;
|
|
||||||
ProgressBar bar{
|
ProgressBar bar{
|
||||||
option::BarWidth{50},
|
option::BarWidth{50},
|
||||||
option::Start{"["},
|
option::Start{"["},
|
||||||
@@ -157,7 +159,7 @@ int main() {
|
|||||||
bar.mark_as_completed();
|
bar.mark_as_completed();
|
||||||
|
|
||||||
// Show cursor
|
// Show cursor
|
||||||
std::cout << "\e[?25h";
|
show_console_cursor(true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -173,11 +175,16 @@ All progress bars and spinners in `indicators` support showing time elapsed and
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <indicators/cursor_control.hpp>
|
||||||
#include <indicators/progress_bar.hpp>
|
#include <indicators/progress_bar.hpp>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace indicators;
|
using namespace indicators;
|
||||||
|
|
||||||
|
// Hide cursor
|
||||||
|
show_console_cursor(false);
|
||||||
|
|
||||||
indicators::ProgressBar bar{
|
indicators::ProgressBar bar{
|
||||||
option::BarWidth{50},
|
option::BarWidth{50},
|
||||||
option::Start{" ["},
|
option::Start{" ["},
|
||||||
@@ -201,7 +208,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show cursor
|
// Show cursor
|
||||||
std::cout << "\e[?25h";
|
show_console_cursor(true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -222,10 +229,11 @@ Are you in need of a smooth block progress bar using [unicode block elements](ht
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
// Hide cursor
|
|
||||||
std::cout << "\e[?25l";
|
|
||||||
using namespace indicators;
|
using namespace indicators;
|
||||||
|
|
||||||
|
// Hide cursor
|
||||||
|
show_console_cursor(false);
|
||||||
|
|
||||||
BlockProgressBar bar{
|
BlockProgressBar bar{
|
||||||
option::BarWidth{80},
|
option::BarWidth{80},
|
||||||
option::Start{"["},
|
option::Start{"["},
|
||||||
@@ -245,7 +253,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show cursor
|
// Show cursor
|
||||||
std::cout << "\e[?25h";
|
show_console_cursor(true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
#include <indicators/progress_bar.hpp>
|
#include <indicators/progress_bar.hpp>
|
||||||
#include <indicators/progress_spinner.hpp>
|
#include <indicators/progress_spinner.hpp>
|
||||||
|
#include <indicators/cursor_control.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
using namespace indicators;
|
||||||
|
|
||||||
// Hide cursor
|
// Hide cursor
|
||||||
std::cout << "\e[?25l";
|
show_console_cursor(false);
|
||||||
using namespace indicators;
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// PROGRESS BAR 1
|
// PROGRESS BAR 1
|
||||||
@@ -312,7 +314,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show cursor
|
// Show cursor
|
||||||
std::cout << "\e[?25h";
|
show_console_cursor(true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <indicators/block_progress_bar.hpp>
|
#include <indicators/block_progress_bar.hpp>
|
||||||
|
#include <indicators/cursor_control.hpp>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
// Hide cursor
|
// Hide cursor
|
||||||
std::cout << "\e[?25l";
|
indicators::show_console_cursor(false);
|
||||||
|
|
||||||
indicators::BlockProgressBar bar{
|
indicators::BlockProgressBar bar{
|
||||||
indicators::option::BarWidth{80},
|
indicators::option::BarWidth{80},
|
||||||
@@ -24,7 +25,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show cursor
|
// Show cursor
|
||||||
std::cout << "\e[?25h";
|
indicators::show_console_cursor(true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
#include <indicators/multi_progress.hpp>
|
#include <indicators/multi_progress.hpp>
|
||||||
#include <indicators/progress_bar.hpp>
|
#include <indicators/progress_bar.hpp>
|
||||||
#include <indicators/cursor_control.hpp>
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
indicators::show_console_cursor(false);
|
|
||||||
|
|
||||||
indicators::ProgressBar bar1{indicators::option::BarWidth{50},
|
indicators::ProgressBar bar1{indicators::option::BarWidth{50},
|
||||||
indicators::option::Start{"["},
|
indicators::option::Start{"["},
|
||||||
@@ -83,7 +81,5 @@ int main() {
|
|||||||
second_job.join();
|
second_job.join();
|
||||||
third_job.join();
|
third_job.join();
|
||||||
|
|
||||||
indicators::show_console_cursor(true);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <indicators/cursor_control.hpp>
|
||||||
#include <indicators/progress_bar.hpp>
|
#include <indicators/progress_bar.hpp>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
// Hide cursor
|
// Hide cursor
|
||||||
std::cout << "\e[?25l";
|
indicators::show_console_cursor(false);
|
||||||
|
|
||||||
indicators::ProgressBar bar{
|
indicators::ProgressBar bar{
|
||||||
indicators::option::BarWidth{50},
|
indicators::option::BarWidth{50},
|
||||||
@@ -47,7 +48,7 @@ int main() {
|
|||||||
bar.mark_as_completed();
|
bar.mark_as_completed();
|
||||||
|
|
||||||
// Show cursor
|
// Show cursor
|
||||||
std::cout << "\e[?25h";
|
indicators::show_console_cursor(true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
#include <indicators/cursor_control.hpp>
|
||||||
#include <indicators/progress_spinner.hpp>
|
#include <indicators/progress_spinner.hpp>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
// Hide cursor
|
// Hide cursor
|
||||||
std::cout << "\e[?25l";
|
indicators::show_console_cursor(false);
|
||||||
|
|
||||||
indicators::ProgressSpinner spinner{
|
indicators::ProgressSpinner spinner{
|
||||||
indicators::option::PostfixText{"Checking credentials"},
|
indicators::option::PostfixText{"Checking credentials"},
|
||||||
@@ -34,7 +35,7 @@ int main() {
|
|||||||
thread.join();
|
thread.join();
|
||||||
|
|
||||||
// Show cursor
|
// Show cursor
|
||||||
std::cout << "\e[?25h";
|
indicators::show_console_cursor(true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <indicators/cursor_control.hpp>
|
||||||
#include <indicators/progress_bar.hpp>
|
#include <indicators/progress_bar.hpp>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
// Hide cursor
|
||||||
|
indicators::show_console_cursor(false);
|
||||||
|
|
||||||
indicators::ProgressBar bar{
|
indicators::ProgressBar bar{
|
||||||
indicators::option::BarWidth{50},
|
indicators::option::BarWidth{50},
|
||||||
indicators::option::Start{" ["},
|
indicators::option::Start{" ["},
|
||||||
@@ -27,7 +31,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show cursor
|
// Show cursor
|
||||||
std::cout << "\e[?25h";
|
indicators::show_console_cursor(true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user