Giter Site home page Giter Site logo

Comments (4)

daniele77 avatar daniele77 commented on August 23, 2024

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.

marcogmaia avatar marcogmaia commented on August 23, 2024

@daniele77, thanks man. I'll test with your configs when I get the time. I compiled with clang on windows.

from cli.

marcogmaia avatar marcogmaia commented on August 23, 2024

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.

marcogmaia avatar marcogmaia commented on August 23, 2024
clitest_vid.mp4

An example using the code that you've provided.

from cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.