aelliixx / cpp-inquirer Goto Github PK
View Code? Open in Web Editor NEWInteractive command line prompts with C++
License: MIT License
Interactive command line prompts with C++
License: MIT License
Hello, first of all, this library is really wonderful, i was looking exactly for something this simple and yet powerful to build my command line tools.
But i'm having some problems when using different type of questions, specifically if i use the 'text' type before every other question, everything works as excepted, but if use any of the other type before the 'text' one, the program stop silently without asking any question at all.
I'm pretty new to C++, so i don't know if this could be something wrong with my setup or the library itself.
Here an example of what i'm talking about, i pretty much just use the same code form your examples.
This way it works, and every question is asked one after another
auto inquirer = alx::Inquirer("");
inquirer.add_question({ "query", "What do you want to do?" });
inquirer.add_question({ "birthday", "Is this for a birthday?", alx::Type::yesNo });
inquirer.add_question({ "candles", "How many candles do you want?", alx::Type::integer });
inquirer.add_question({ "delivery", "Is this for delivery?", alx::Type::confirm });
inquirer.add_question({ "type", "What kind of a cake would you like?",
std::vector<std::string>{ "Chocolate", "Ice-cream", "Cheesecake", "Red velvet" }});
inquirer.ask();
But just doing this cause my problem, any other type of question does not work if a 'text' question is not asked before, and nothing come out of the terminal
auto inquirer = alx::Inquirer("");
//inquirer.add_question({ "query", "What do you want to do?" });
inquirer.add_question({ "birthday", "Is this for a birthday?", alx::Type::yesNo });
inquirer.add_question({ "candles", "How many candles do you want?", alx::Type::integer });
inquirer.add_question({ "delivery", "Is this for delivery?", alx::Type::confirm });
inquirer.add_question({ "type", "What kind of a cake would you like?",
std::vector<std::string>{ "Chocolate", "Ice-cream", "Cheesecake", "Red velvet" }});
inquirer.ask();
What could be the problem?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.