This library is thought to add easily in C++ application some common command line widgets.
For the moment the following is supported :
cli_widgets::spin_loader loader(std::cout);
loader.launch();
some_long_running_computation();
loader.stop();
See spin_loader.cpp for more example.
std::string passphrase;
std::cout << "Please enter your password : ";
{
cli_widgets::hidden_input_guard hide_password{};
std::cin >> passphrase;
}
See stdin_hide_guard.cpp for more example.
The no-need-to-worry-about-collection-boundaries-circular-iterrator-string-symbol-spinner:
const std::vector<std::string> symbols { "v", "<", "^", ">" };
cli_widgets::symbol_cycler spinner(symbols);
for(int i = 50; i > 0; i--) {
std::cout << "\r" << spinner.next() << std::flush;
std::this_thread::sleep_for(step_slow);
}
There are a bunch of symbol collections to be found in the cli_widgets::spinner_symbols
namespace!
A fully fledged example, including of how to use this one in conjunction with cli_widgets::symbol_cycler
can be found in symbol_cycler.cpp
.
Please give copyright notice for this project.
Copyright (c) 2018 - Damien Buhl alias daminetreg (damien.buhl@lecbna.org)
Copyright (c) 2021 - Tipi Technologies Ltd. (hello@tipi.build)