diff options
Diffstat (limited to 'src/bitcoin-util.cpp')
-rw-r--r-- | src/bitcoin-util.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/bitcoin-util.cpp b/src/bitcoin-util.cpp index f7e670f4e0..b702a68bdf 100644 --- a/src/bitcoin-util.cpp +++ b/src/bitcoin-util.cpp @@ -40,6 +40,8 @@ static void SetupBitcoinUtilArgs(ArgsManager &argsman) { SetupHelpOptions(argsman); + argsman.AddArg("-version", "Print version and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); + SetupChainParamsBaseOptions(argsman); } @@ -62,12 +64,14 @@ static int AppInitUtil(int argc, char* argv[]) return EXIT_FAILURE; } - if (argc < 2 || HelpRequested(gArgs)) { + if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) { // First part of help message is specific to this utility - std::string strUsage = PACKAGE_NAME " bitcoin-util utility version " + FormatFullVersion() + "\n\n" + - "Usage: bitcoin-util [options] [commands] Do stuff\n" + - "\n"; - strUsage += gArgs.GetHelpMessage(); + std::string strUsage = PACKAGE_NAME " bitcoin-util utility version " + FormatFullVersion() + "\n"; + if (!gArgs.IsArgSet("-version")) { + strUsage += "\n" + "Usage: bitcoin-util [options] [commands] Do stuff\n"; + strUsage += "\n" + gArgs.GetHelpMessage(); + } tfm::format(std::cout, "%s", strUsage); |