diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index cbd655460..04bac1928 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -268,6 +268,7 @@ namespace const char* USAGE_WELCOME("welcome"); const char* USAGE_SHOW_QR_CODE("show_qr_code []"); const char* USAGE_VERSION("version"); + const char* USAGE_CLEAR("clear"); const char* USAGE_HELP("help [ | all]"); const char* USAGE_APROPOS("apropos [ ...]"); const char* USAGE_SCAN_TX("scan_tx [ ...]"); @@ -2140,6 +2141,13 @@ bool simple_wallet::version(const std::vector &args) return true; } +bool simple_wallet::clear(const std::vector &args) +{ + PAUSE_READLINE(); + tools::clear_screen(); + return true; +} + bool simple_wallet::on_unknown_command(const std::vector &args) { if (args[0] == "exit" || args[0] == "q") // backward compat @@ -3508,6 +3516,10 @@ simple_wallet::simple_wallet() boost::bind(&simple_wallet::on_command, this, &simple_wallet::version, _1), tr(USAGE_VERSION), tr("Returns version information")); + m_cmd_binder.set_handler("clear", + boost::bind(&simple_wallet::on_command, this, &simple_wallet::clear, _1), + tr(USAGE_CLEAR), + tr("Clear the console screen")); m_cmd_binder.set_handler("show_qr_code", boost::bind(&simple_wallet::on_command, this, &simple_wallet::show_qr_code, _1), tr(USAGE_SHOW_QR_CODE), diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 6d8719ab0..54c4e00c7 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -256,6 +256,7 @@ namespace cryptonote bool public_nodes(const std::vector& args); bool welcome(const std::vector& args); bool version(const std::vector& args); + bool clear(const std::vector& args); bool on_unknown_command(const std::vector& args); bool cold_sign_tx(const std::vector& ptx_vector, tools::wallet2::signed_tx_set &exported_txs, std::vector &dsts_info, std::function accept_func);