We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
You can continue the conversation there. Go to discussion →
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I'm having some trouble with the example in README. This compiles correctly but gives a segfault when executed.
#include "cli/cli.h" #include "cli/clifilesession.h" using namespace cli; using namespace std; int main() { // setup cli auto rootMenu = make_unique<Menu>("myprompt"); auto menuA = make_unique<Menu>("a_prompt"); rootMenu->Insert(std::move(menuA)); auto menuAA = make_unique<Menu>("aa_prompt"); menuA->Insert(std::move(menuAA)); auto menuAB = make_unique<Menu>("ab_prompt"); menuA->Insert(std::move(menuAB)); auto menuAC = make_unique<Menu>("ac_prompt"); menuA->Insert(std::move(menuAC)); auto menuACA = make_unique<Menu>("aca_prompt"); menuAC->Insert(std::move(menuACA)); auto menuB = make_unique<Menu>("b_prompt"); rootMenu->Insert(std::move(menuB)); auto menuBA = make_unique<Menu>("ba_prompt"); menuB->Insert(std::move(menuBA)); auto menuBB = make_unique<Menu>("bb_prompt"); menuB->Insert(std::move(menuBB)); Cli cli(std::move(rootMenu)); // global exit action cli.ExitAction( [](auto &out) { out << "Goodbye and thanks for all the fish.\n"; }); CliFileSession input(cli); input.Start(); return 0; }
A way of making it work is the following:
int main() { // setup cli auto rootMenu = make_unique<Menu>("myprompt"); auto menuA = make_unique<Menu>("a_prompt"); auto menuAA = make_unique<Menu>("aa_prompt"); auto menuAB = make_unique<Menu>("ab_prompt"); auto menuAC = make_unique<Menu>("ac_prompt"); auto menuACA = make_unique<Menu>("aca_prompt"); auto menuB = make_unique<Menu>("b_prompt"); auto menuBA = make_unique<Menu>("ba_prompt"); auto menuBB = make_unique<Menu>("bb_prompt"); menuAC->Insert(std::move(menuACA)); menuB->Insert(std::move(menuBB)); menuB->Insert(std::move(menuBA)); menuA->Insert(std::move(menuAA)); menuA->Insert(std::move(menuAB)); menuA->Insert(std::move(menuAC)); rootMenu->Insert(std::move(menuA)); rootMenu->Insert(std::move(menuB)); Cli cli(std::move(rootMenu)); // global exit action cli.ExitAction( [](auto &out) { out << "Goodbye and thanks for all the fish.\n"; }); CliFileSession input(cli); input.Start(); return 0; }
I'm not sure why, unfortunately I don't have much time to study the problem. Hope this can help.
Thanks for you work, Luca
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I'm having some trouble with the example in README. This compiles correctly but gives a segfault when executed.
A way of making it work is the following:
I'm not sure why, unfortunately I don't have much time to study the problem. Hope this can help.
Thanks for you work,
Luca
The text was updated successfully, but these errors were encountered: