@@ -24,6 +24,7 @@ static void SetupWalletToolArgs(ArgsManager& argsman)
24
24
SetupHelpOptions (argsman);
25
25
SetupChainParamsBaseOptions (argsman);
26
26
27
+ argsman.AddArg (" -version" , " Print version and exit" , ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
27
28
argsman.AddArg (" -datadir=<dir>" , " Specify data directory" , ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
28
29
argsman.AddArg (" -wallet=<wallet-name>" , " Specify wallet name" , ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::OPTIONS);
29
30
argsman.AddArg (" -debug=<category>" , " Output debugging information (default: 0)." , ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
@@ -42,16 +43,18 @@ static bool WalletAppInit(int argc, char* argv[])
42
43
tfm::format (std::cerr, " Error parsing command line arguments: %s\n " , error_message);
43
44
return false ;
44
45
}
45
- if (argc < 2 || HelpRequested (gArgs )) {
46
- std::string usage = strprintf (" %s bitcoin-wallet version" , PACKAGE_NAME) + " " + FormatFullVersion () + " \n\n " +
47
- " bitcoin-wallet is an offline tool for creating and interacting with " PACKAGE_NAME " wallet files.\n " +
48
- " By default bitcoin-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n " +
49
- " To change the target wallet, use the -datadir, -wallet and -testnet/-regtest arguments.\n\n " +
50
- " Usage:\n " +
51
- " bitcoin-wallet [options] <command>\n\n " +
52
- gArgs .GetHelpMessage ();
53
-
54
- tfm::format (std::cout, " %s" , usage);
46
+ if (argc < 2 || HelpRequested (gArgs ) || gArgs .IsArgSet (" -version" )) {
47
+ std::string strUsage = strprintf (" %s bitcoin-wallet version" , PACKAGE_NAME) + " " + FormatFullVersion () + " \n " ;
48
+ if (!gArgs .IsArgSet (" -version" )) {
49
+ strUsage += " \n "
50
+ " bitcoin-wallet is an offline tool for creating and interacting with " PACKAGE_NAME " wallet files.\n "
51
+ " By default bitcoin-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n "
52
+ " To change the target wallet, use the -datadir, -wallet and -testnet/-regtest arguments.\n\n "
53
+ " Usage:\n "
54
+ " bitcoin-wallet [options] <command>\n " ;
55
+ strUsage += " \n " + gArgs .GetHelpMessage ();
56
+ }
57
+ tfm::format (std::cout, " %s" , strUsage);
55
58
return false ;
56
59
}
57
60
0 commit comments