Merge pull request #3630

51b511be simplewallet: add version command (moneromooo-monero)
35d1269f daemon: add a version command (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-04-21 21:55:28 +02:00
commit 7e98e9d7ce
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
5 changed files with 26 additions and 0 deletions

View File

@ -27,6 +27,7 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common/dns_utils.h" #include "common/dns_utils.h"
#include "version.h"
#include "daemon/command_parser_executor.h" #include "daemon/command_parser_executor.h"
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY
@ -664,4 +665,10 @@ bool t_command_parser_executor::sync_info(const std::vector<std::string>& args)
return m_executor.sync_info(); return m_executor.sync_info();
} }
bool t_command_parser_executor::version(const std::vector<std::string>& args)
{
std::cout << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << std::endl;
return true;
}
} // namespace daemonize } // namespace daemonize

View File

@ -138,6 +138,8 @@ public:
bool relay_tx(const std::vector<std::string>& args); bool relay_tx(const std::vector<std::string>& args);
bool sync_info(const std::vector<std::string>& args); bool sync_info(const std::vector<std::string>& args);
bool version(const std::vector<std::string>& args);
}; };
} // namespace daemonize } // namespace daemonize

View File

@ -280,6 +280,11 @@ t_command_server::t_command_server(
, std::bind(&t_command_parser_executor::sync_info, &m_parser, p::_1) , std::bind(&t_command_parser_executor::sync_info, &m_parser, p::_1)
, "Print information about the blockchain sync state." , "Print information about the blockchain sync state."
); );
m_command_lookup.set_handler(
"version"
, std::bind(&t_command_parser_executor::version, &m_parser, p::_1)
, "Print version information."
);
} }
bool t_command_server::process_command_str(const std::string& cmd) bool t_command_server::process_command_str(const std::string& cmd)

View File

@ -62,6 +62,7 @@
#include "ringct/rctSigs.h" #include "ringct/rctSigs.h"
#include "multisig/multisig.h" #include "multisig/multisig.h"
#include "wallet/wallet_args.h" #include "wallet/wallet_args.h"
#include "version.h"
#include <stdexcept> #include <stdexcept>
#ifdef WIN32 #ifdef WIN32
@ -1584,6 +1585,12 @@ bool simple_wallet::save_known_rings(const std::vector<std::string> &args)
return true; return true;
} }
bool simple_wallet::version(const std::vector<std::string> &args)
{
message_writer() << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")";
return true;
}
bool simple_wallet::set_always_confirm_transfers(const std::vector<std::string> &args/* = std::vector<std::string>()*/) bool simple_wallet::set_always_confirm_transfers(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
{ {
const auto pwd_container = get_and_verify_password(); const auto pwd_container = get_and_verify_password();
@ -2335,6 +2342,10 @@ simple_wallet::simple_wallet()
boost::bind(&simple_wallet::blackballed, this, _1), boost::bind(&simple_wallet::blackballed, this, _1),
tr("blackballed <output public key>"), tr("blackballed <output public key>"),
tr("Checks whether an output is blackballed")); tr("Checks whether an output is blackballed"));
m_cmd_binder.set_handler("version",
boost::bind(&simple_wallet::version, this, _1),
tr("version"),
tr("Returns version information"));
m_cmd_binder.set_handler("help", m_cmd_binder.set_handler("help",
boost::bind(&simple_wallet::help, this, _1), boost::bind(&simple_wallet::help, this, _1),
tr("help [<command>]"), tr("help [<command>]"),

View File

@ -218,6 +218,7 @@ namespace cryptonote
bool blackball(const std::vector<std::string>& args); bool blackball(const std::vector<std::string>& args);
bool unblackball(const std::vector<std::string>& args); bool unblackball(const std::vector<std::string>& args);
bool blackballed(const std::vector<std::string>& args); bool blackballed(const std::vector<std::string>& args);
bool version(const std::vector<std::string>& args);
uint64_t get_daemon_blockchain_height(std::string& err); uint64_t get_daemon_blockchain_height(std::string& err);
bool try_connect_to_daemon(bool silent = false, uint32_t* version = nullptr); bool try_connect_to_daemon(bool silent = false, uint32_t* version = nullptr);