mirror of
https://github.com/monero-project/monero.git
synced 2025-06-21 06:14:11 -04:00
Merge pull request #2736
0d9c0db9
Do not build against epee_readline if it was not built (Howard Chu)178014c9
split off readline code into epee_readline (moneromooo-monero)a9e14a19
link against readline only for monerod and wallet-wallet-{rpc,cli} (moneromooo-monero)437421ce
wallet: move some scoped_message_writer calls from the libs (moneromooo-monero)e89994e9
wallet: rejig to avoid prompting in wallet2 (moneromooo-monero)ec5135e5
move input_line from command_line to simplewallet (moneromooo-monero)082db75f
move cryptonote command line options to cryptonote_core (moneromooo-monero)
This commit is contained in:
commit
edebe4e3b6
31 changed files with 329 additions and 300 deletions
|
@ -36,10 +36,6 @@
|
|||
#include "cryptonote_config.h"
|
||||
#include "string_tools.h"
|
||||
|
||||
#ifdef HAVE_READLINE
|
||||
#include "readline_buffer.h"
|
||||
#endif
|
||||
|
||||
namespace command_line
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (str == "y" || str == "Y")
|
||||
|
@ -94,49 +76,4 @@ namespace command_line
|
|||
|
||||
const arg_descriptor<bool> arg_help = {"help", "Produce help message"};
|
||||
const arg_descriptor<bool> arg_version = {"version", "Output version information"};
|
||||
const arg_descriptor<std::string> arg_data_dir = {"data-dir", "Specify data directory"};
|
||||
const arg_descriptor<std::string> arg_testnet_data_dir = {"testnet-data-dir", "Specify testnet data directory"};
|
||||
const arg_descriptor<bool> arg_test_drop_download = {"test-drop-download", "For net tests: in download, discard ALL blocks instead checking/saving them (very fast)"};
|
||||
const arg_descriptor<uint64_t> arg_test_drop_download_height = {"test-drop-download-height", "Like test-drop-download but disards only after around certain height", 0};
|
||||
const arg_descriptor<int> arg_test_dbg_lock_sleep = {"test-dbg-lock-sleep", "Sleep time in ms, defaults to 0 (off), used to debug before/after locking mutex. Values 100 to 1000 are good for tests."};
|
||||
const arg_descriptor<bool, false> arg_testnet_on = {
|
||||
"testnet"
|
||||
, "Run on testnet. The wallet must be launched with --testnet flag."
|
||||
, false
|
||||
};
|
||||
const arg_descriptor<bool> arg_dns_checkpoints = {
|
||||
"enforce-dns-checkpointing"
|
||||
, "checkpoints from DNS server will be enforced"
|
||||
, false
|
||||
};
|
||||
const command_line::arg_descriptor<uint64_t> arg_fast_block_sync = {
|
||||
"fast-block-sync"
|
||||
, "Sync up most of the way by using embedded, known block hashes."
|
||||
, 1
|
||||
};
|
||||
const command_line::arg_descriptor<uint64_t> arg_prep_blocks_threads = {
|
||||
"prep-blocks-threads"
|
||||
, "Max number of threads to use when preparing block hashes in groups."
|
||||
, 4
|
||||
};
|
||||
const command_line::arg_descriptor<uint64_t> arg_show_time_stats = {
|
||||
"show-time-stats"
|
||||
, "Show time-stats when processing blocks/txs and disk synchronization."
|
||||
, 0
|
||||
};
|
||||
const command_line::arg_descriptor<size_t> arg_block_sync_size = {
|
||||
"block-sync-size"
|
||||
, "How many blocks to sync at once during chain synchronization (0 = adaptive)."
|
||||
, 0
|
||||
};
|
||||
const command_line::arg_descriptor<std::string> arg_check_updates = {
|
||||
"check-updates"
|
||||
, "Check for new versions of monero: [disabled|notify|download|update]"
|
||||
, "notify"
|
||||
};
|
||||
const arg_descriptor<bool> arg_fluffy_blocks = {
|
||||
"fluffy-blocks"
|
||||
, "Relay blocks as fluffy blocks where possible (automatic on testnet)"
|
||||
, false
|
||||
};
|
||||
}
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
namespace command_line
|
||||
{
|
||||
|
||||
std::string input_line(const std::string& prompt);
|
||||
|
||||
//! \return True if `str` is `is_iequal("y" || "yes" || `tr("yes"))`.
|
||||
bool is_yes(const std::string& str);
|
||||
//! \return True if `str` is `is_iequal("n" || "no" || `tr("no"))`.
|
||||
|
@ -213,17 +211,4 @@ namespace command_line
|
|||
|
||||
extern const arg_descriptor<bool> arg_help;
|
||||
extern const arg_descriptor<bool> arg_version;
|
||||
extern const arg_descriptor<std::string> arg_data_dir;
|
||||
extern const arg_descriptor<std::string> arg_testnet_data_dir;
|
||||
extern const arg_descriptor<bool> arg_test_drop_download;
|
||||
extern const arg_descriptor<uint64_t> arg_test_drop_download_height;
|
||||
extern const arg_descriptor<int> arg_test_dbg_lock_sleep;
|
||||
extern const arg_descriptor<bool, false> arg_testnet_on;
|
||||
extern const arg_descriptor<bool> arg_dns_checkpoints;
|
||||
extern const arg_descriptor<uint64_t> arg_fast_block_sync;
|
||||
extern const arg_descriptor<uint64_t> arg_prep_blocks_threads;
|
||||
extern const arg_descriptor<uint64_t> arg_show_time_stats;
|
||||
extern const arg_descriptor<size_t> arg_block_sync_size;
|
||||
extern const arg_descriptor<std::string> arg_check_updates;
|
||||
extern const arg_descriptor<bool> arg_fluffy_blocks;
|
||||
}
|
||||
|
|
|
@ -238,9 +238,6 @@ namespace tools
|
|||
|
||||
boost::optional<password_container> password_container::prompt(const bool verify, const char *message)
|
||||
{
|
||||
#ifdef HAVE_READLINE
|
||||
rdln::suspend_readline pause_readline;
|
||||
#endif
|
||||
password_container pass1{};
|
||||
password_container pass2{};
|
||||
if (is_cin_tty() ? read_from_tty(verify, message, pass1.m_password, pass2.m_password) : read_from_file(pass1.m_password))
|
||||
|
@ -249,7 +246,7 @@ namespace tools
|
|||
return boost::none;
|
||||
}
|
||||
|
||||
boost::optional<login> login::parse(std::string&& userpass, bool verify, const char* message)
|
||||
boost::optional<login> login::parse(std::string&& userpass, bool verify, const std::function<boost::optional<password_container>(bool)> &prompt)
|
||||
{
|
||||
login out{};
|
||||
password_container wipe{std::move(userpass)};
|
||||
|
@ -257,7 +254,7 @@ namespace tools
|
|||
const auto loc = wipe.password().find(':');
|
||||
if (loc == std::string::npos)
|
||||
{
|
||||
auto result = tools::password_container::prompt(verify, message);
|
||||
auto result = prompt(verify);
|
||||
if (!result)
|
||||
return boost::none;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace tools
|
|||
\return The username and password, or boost::none if
|
||||
`password_container::prompt` fails.
|
||||
*/
|
||||
static boost::optional<login> parse(std::string&& userpass, bool verify, const char* message = "Password");
|
||||
static boost::optional<login> parse(std::string&& userpass, bool verify, const std::function<boost::optional<password_container>(bool)> &prompt);
|
||||
|
||||
login(const login&) = delete;
|
||||
login(login&&) = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue