Comments (4)
Hi @marcogmaia ,
first of all, thank you very much for using this library.
I tried your code in the following environment:
- visual studio 2022, Debug build
- visual studio 2022, Release build
- linux kubuntu, GCC v. 11.4.0
In all three cases, I've got the expected output:
c:\Progetti\github\esempi_cli\cli_example\x64\Release>cli_example.exe
cli> exit
Stopping scheduler...
Waiting for extra keypress...
Exiting from main.
c:\Progetti\github\esempi_cli\cli_example\x64\Release>
(no extra keypress needed, by the way: I've just entered "exit" followed by key).
The complete code is:
#include <cli/loopscheduler.h>
#include "cli/clilocalsession.h"
#include "cli/cli.h"
int main() {
std::atexit([]() { std::cout << "Exiting from main."; });
auto cli = cli::Cli(std::make_unique<cli::Menu>("cli"));
cli.ExitAction([](auto& out) { out << "Waiting for extra keypress...\n"; });
auto scheduler = cli::LoopScheduler();
auto session = cli::CliLocalSession(cli, scheduler, std::cout, 400);
session.ExitAction([&scheduler](auto& out) {
scheduler.Stop();
out << "Stopping scheduler...\n";
});
scheduler.Run();
return 0;
}
using C++20 standard and the latest version of cli library (i.e., v. 2.1).
Please, let me know what differs from your environment.
from cli.
@daniele77, thanks man. I'll test with your configs when I get the time. I compiled with clang on windows.
from cli.
It seems to correctly work with PowerShell
, the issue that I was experiencing was with some integrated terminals, like the VSCode
integrated terminal and Windows terminal
, but if the application is used in a standalone mode it works correctly.
I've tested with msvc2022 and clang17.
from cli.
clitest_vid.mp4
An example using the code that you've provided.
from cli.
Related Issues (20)
- Run short command without autocompletion
- Missing echo after paste of command HOT 3
- class asio::io_context::work’ has no member named ‘reset’ HOT 3
- can NOT connect telnet HOT 1
- find_package(cli) doesn't define cli_VERSION HOT 2
- The filesession.cpp example doesn't work
- command parser allows unclosed quoted strings (in the example complete.cpp) HOT 1
- Is it possible to pipe input?
- Dynamically change menu prompt
- Text pasted from the clipboard doesn'r get into the cli prompt HOT 1
- Getting command by name HOT 1
- Prompt label access HOT 3
- Is there any way to add options aftrer input data
- How to add internal command used to enter system shell
- How to specify optional arguments for a CLI handler?
- Bad file descriptor on ARM build HOT 6
- Add SubMenu class HOT 1
- how to trap keypress inside a command?
- Custom handler for wrong commands HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.