mirror of
https://github.com/davidallendj/gdpm.git
synced 2025-12-20 22:00:04 -07:00
Fixed prompt logic and version command
This commit is contained in:
parent
c88cb08e03
commit
3be3d01388
2 changed files with 14 additions and 11 deletions
|
|
@ -213,11 +213,11 @@ namespace gdpm::utils{
|
|||
|
||||
bool prompt_user_yn(const char *message){
|
||||
std::string input{""};
|
||||
while( !std::cin.fail() && input != "y" && input != "n" ){
|
||||
bool is_default = (input == "\0" || input == "\n" || input == "\r\n" || input.empty());
|
||||
while( input != "y" && input != "n" ){
|
||||
input = to_lower(utils::prompt_user(message));
|
||||
bool is_default = (input == "\0" || input == "\n" || input == "\r\n" || input.empty());
|
||||
input = is_default ? "y" : input;
|
||||
}
|
||||
}
|
||||
return input == "y";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue