Skip to content

Commit 2618fb8

Browse files
committed
Output license info when binaries are passed -version
Consolidate to outputting the licensing info when we pass -version to a binary, i.e bitcoind -version: ```bash itcoin Core version v22.99.0-fc1f355913f6-dirty Copyright (C) 2009-2022 The Bitcoin Core developers Please contribute if you find Bitcoin Core useful. Visit <https://bitcoincore.org/> for further information about the software. The source code is available from <https://github.com/bitcoin/bitcoin>. This is experimental software. Distributed under the MIT software license, see the accompanying file COPYING or <https://opensource.org/licenses/MIT> ```
1 parent 4c3e3c5 commit 2618fb8

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

src/bitcoin-cli.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ static int AppInitRPC(int argc, char* argv[])
133133
}
134134
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
135135
std::string strUsage = PACKAGE_NAME " RPC client version " + FormatFullVersion() + "\n";
136-
if (!gArgs.IsArgSet("-version")) {
136+
137+
if (gArgs.IsArgSet("-version")) {
138+
strUsage += FormatParagraph(LicenseInfo());
139+
} else {
137140
strUsage += "\n"
138141
"Usage: bitcoin-cli [options] <command> [params] Send command to " PACKAGE_NAME "\n"
139142
"or: bitcoin-cli [options] -named <command> [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n"

src/bitcoin-tx.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ static int AppInitRawTx(int argc, char* argv[])
102102
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
103103
// First part of help message is specific to this utility
104104
std::string strUsage = PACKAGE_NAME " bitcoin-tx utility version " + FormatFullVersion() + "\n";
105-
if (!gArgs.IsArgSet("-version")) {
105+
106+
if (gArgs.IsArgSet("-version")) {
107+
strUsage += FormatParagraph(LicenseInfo());
108+
} else {
106109
strUsage += "\n"
107110
"Usage: bitcoin-tx [options] <hex-tx> [commands] Update hex-encoded bitcoin transaction\n"
108111
"or: bitcoin-tx [options] -create [commands] Create hex-encoded bitcoin transaction\n"

src/bitcoin-util.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ static int AppInitUtil(ArgsManager& args, int argc, char* argv[])
5353
if (HelpRequested(args) || args.IsArgSet("-version")) {
5454
// First part of help message is specific to this utility
5555
std::string strUsage = PACKAGE_NAME " bitcoin-util utility version " + FormatFullVersion() + "\n";
56-
if (!args.IsArgSet("-version")) {
56+
57+
if (args.IsArgSet("-version")) {
58+
strUsage += FormatParagraph(LicenseInfo());
59+
} else {
5760
strUsage += "\n"
5861
"Usage: bitcoin-util [options] [commands] Do stuff\n";
5962
strUsage += "\n" + args.GetHelpMessage();

src/bitcoin-wallet.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ static bool WalletAppInit(ArgsManager& args, int argc, char* argv[])
5959
}
6060
if (argc < 2 || HelpRequested(args) || args.IsArgSet("-version")) {
6161
std::string strUsage = strprintf("%s bitcoin-wallet version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n";
62-
if (!args.IsArgSet("-version")) {
62+
63+
if (args.IsArgSet("-version")) {
64+
strUsage += FormatParagraph(LicenseInfo());
65+
} else {
6366
strUsage += "\n"
6467
"bitcoin-wallet is an offline tool for creating and interacting with " PACKAGE_NAME " wallet files.\n"
6568
"By default bitcoin-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n"

src/bitcoind.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,10 @@ static bool AppInit(NodeContext& node, int argc, char* argv[])
126126
if (HelpRequested(args) || args.IsArgSet("-version")) {
127127
std::string strUsage = PACKAGE_NAME " version " + FormatFullVersion() + "\n";
128128

129-
if (!args.IsArgSet("-version")) {
130-
strUsage += FormatParagraph(LicenseInfo()) + "\n"
131-
"\nUsage: bitcoind [options] Start " PACKAGE_NAME "\n"
129+
if (args.IsArgSet("-version")) {
130+
strUsage += FormatParagraph(LicenseInfo());
131+
} else {
132+
strUsage += "\nUsage: bitcoind [options] Start " PACKAGE_NAME "\n"
132133
"\n";
133134
strUsage += args.GetHelpMessage();
134135
}

0 commit comments

Comments
 (0)