diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/command_line.cpp | 63 | ||||
-rw-r--r-- | src/common/command_line.h | 15 | ||||
-rw-r--r-- | src/common/password.cpp | 7 | ||||
-rw-r--r-- | src/common/password.h | 2 |
4 files changed, 3 insertions, 84 deletions
diff --git a/src/common/command_line.cpp b/src/common/command_line.cpp index d4a28fc85..4b9ca9559 100644 --- a/src/common/command_line.cpp +++ b/src/common/command_line.cpp @@ -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 - }; } diff --git a/src/common/command_line.h b/src/common/command_line.h index bfc8b19c6..c2bac9cc8 100644 --- a/src/common/command_line.h +++ b/src/common/command_line.h @@ -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; } diff --git a/src/common/password.cpp b/src/common/password.cpp index b84d6fb2e..5d56464a5 100644 --- a/src/common/password.cpp +++ b/src/common/password.cpp @@ -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; diff --git a/src/common/password.h b/src/common/password.h index 12f715df4..ba1c30a28 100644 --- a/src/common/password.h +++ b/src/common/password.h @@ -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; |