move input_line from command_line to simplewallet

It was only used there, and this removes one part of the common
dependency on libreadline
This commit is contained in:
moneromooo-monero 2017-10-28 16:09:13 +01:00
parent 082db75f28
commit ec5135e5b7
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 13 additions and 20 deletions

View file

@ -36,10 +36,6 @@
#include "cryptonote_config.h" #include "cryptonote_config.h"
#include "string_tools.h" #include "string_tools.h"
#ifdef HAVE_READLINE
#include "readline_buffer.h"
#endif
namespace command_line namespace command_line
{ {
namespace namespace
@ -50,20 +46,6 @@ namespace command_line
} }
} }
std::string input_line(const std::string& prompt)
{
#ifdef HAVE_READLINE
rdln::suspend_readline pause_readline;
#endif
std::cout << prompt;
std::string buf;
std::getline(std::cin, buf);
return epee::string_tools::trim(buf);
}
bool is_yes(const std::string& str) bool is_yes(const std::string& str)
{ {
if (str == "y" || str == "Y") if (str == "y" || str == "Y")

View file

@ -41,8 +41,6 @@
namespace command_line namespace command_line
{ {
std::string input_line(const std::string& prompt);
//! \return True if `str` is `is_iequal("y" || "yes" || `tr("yes"))`. //! \return True if `str` is `is_iequal("y" || "yes" || `tr("yes"))`.
bool is_yes(const std::string& str); bool is_yes(const std::string& str);
//! \return True if `str` is `is_iequal("n" || "no" || `tr("no"))`. //! \return True if `str` is `is_iequal("n" || "no" || `tr("no"))`.

View file

@ -125,6 +125,19 @@ namespace
const command_line::arg_descriptor< std::vector<std::string> > arg_command = {"command", ""}; const command_line::arg_descriptor< std::vector<std::string> > arg_command = {"command", ""};
std::string input_line(const std::string& prompt)
{
#ifdef HAVE_READLINE
rdln::suspend_readline pause_readline;
#endif
std::cout << prompt;
std::string buf;
std::getline(std::cin, buf);
return epee::string_tools::trim(buf);
}
inline std::string interpret_rpc_response(bool ok, const std::string& status) inline std::string interpret_rpc_response(bool ok, const std::string& status)
{ {
std::string err; std::string err;