add clear screen command

This commit is contained in:
wowario 2023-02-25 09:42:23 +03:00
parent 934cd71608
commit 6ca2369b67
No known key found for this signature in database
GPG Key ID: 793504B449C69220
2 changed files with 15 additions and 1 deletions

View File

@ -3194,7 +3194,7 @@ bool simple_wallet::help(const std::vector<std::string> &args/* = std::vector<st
message_writer() << tr("\"status\" - Check current status of wallet."); message_writer() << tr("\"status\" - Check current status of wallet.");
message_writer() << tr("\"version\" - Check software version."); message_writer() << tr("\"version\" - Check software version.");
message_writer() << tr("\"exit\" - Exit wallet."); message_writer() << tr("\"exit\" - Exit wallet.");
message_writer() << ""; message_writer() << tr("\"clear\" - Clear screen.");
message_writer() << tr("\"donate <amount>\" - Donate WOW to the development team."); message_writer() << tr("\"donate <amount>\" - Donate WOW to the development team.");
message_writer() << ""; message_writer() << "";
} }
@ -3316,6 +3316,9 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("refresh", m_cmd_binder.set_handler("refresh",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::refresh, _1), boost::bind(&simple_wallet::on_command, this, &simple_wallet::refresh, _1),
tr("Synchronize the transactions and balance.")); tr("Synchronize the transactions and balance."));
m_cmd_binder.set_handler("clear",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::clear, _1),
tr("Clear screen."));
m_cmd_binder.set_handler("balance", m_cmd_binder.set_handler("balance",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::show_balance, _1), boost::bind(&simple_wallet::on_command, this, &simple_wallet::show_balance, _1),
tr(USAGE_SHOW_BALANCE), tr(USAGE_SHOW_BALANCE),
@ -6031,6 +6034,16 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
return refresh_main(start_height, ResetNone); return refresh_main(start_height, ResetNone);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
bool simple_wallet::clear(const std::vector<std::string>& args)
{
#ifdef HAVE_READLINE
PAUSE_READLINE();
rdln::clear_screen();
#endif
tools::clear_screen();
return true;
}
//----------------------------------------------------------------------------------------------------
bool simple_wallet::show_balance_unlocked(bool detailed) bool simple_wallet::show_balance_unlocked(bool detailed)
{ {
std::string extra; std::string extra;

View File

@ -165,6 +165,7 @@ namespace cryptonote
bool set_daemon(const std::vector<std::string> &args); bool set_daemon(const std::vector<std::string> &args);
bool save_bc(const std::vector<std::string> &args); bool save_bc(const std::vector<std::string> &args);
bool refresh(const std::vector<std::string> &args); bool refresh(const std::vector<std::string> &args);
bool clear(const std::vector<std::string> &args);
bool show_balance_unlocked(bool detailed = false); bool show_balance_unlocked(bool detailed = false);
bool show_balance(const std::vector<std::string> &args = std::vector<std::string>()); bool show_balance(const std::vector<std::string> &args = std::vector<std::string>());
bool show_incoming_transfers(const std::vector<std::string> &args); bool show_incoming_transfers(const std::vector<std::string> &args);