From 557270db3949bfebd5fa67d0e41dff4f50982e8b Mon Sep 17 00:00:00 2001 From: sierra19XX <15652887+sierra19XX@users.noreply.github.com> Date: Fri, 21 May 2021 14:27:03 +0000 Subject: [PATCH] add cli wallet version --- programs/cli_wallet/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/programs/cli_wallet/main.cpp b/programs/cli_wallet/main.cpp index bb7afa1a..5a0ee3ba 100644 --- a/programs/cli_wallet/main.cpp +++ b/programs/cli_wallet/main.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -74,6 +75,7 @@ int main( int argc, char** argv ) boost::program_options::options_description opts; opts.add_options() ("help,h", "Print this help message and exit.") + ("version", "Display the version info and exit") ("server-rpc-endpoint,s", bpo::value()->implicit_value("ws://127.0.0.1:8090"), "Server websocket RPC endpoint") ("server-rpc-user,u", bpo::value(), "Server Username") ("server-rpc-password,p", bpo::value(), "Server Password") @@ -95,6 +97,20 @@ int main( int argc, char** argv ) return 0; } + if (options.count("version")) + { + std::string wallet_version(graphene::utilities::git_revision_description); + const size_t pos = wallet_version.find('/'); + if( pos != std::string::npos && wallet_version.size() > pos ) + wallet_version = wallet_version.substr( pos + 1 ); + std::cerr << "Version: " << wallet_version << "\n"; + std::cerr << "Git Revision: " << graphene::utilities::git_revision_sha << "\n"; + std::cerr << "Built: " << __DATE__ " at " __TIME__ << "\n"; + std::cout << "SSL: " << OPENSSL_VERSION_TEXT << "\n"; + std::cout << "Boost: " << boost::replace_all_copy(std::string(BOOST_LIB_VERSION), "_", ".") << "\n"; + return 0; + } + fc::path data_dir; fc::logging_config cfg; fc::path log_dir = data_dir / "logs";