Skip to content

Commit 397cc86

Browse files
hodlinatorluke-jr
authored andcommitted
scripted-diff: Avoid printing version information for -noversion
-BEGIN VERIFY SCRIPT- sed -i --regexp-extended 's/\b(gArgs|args)\.IsArgSet\("-version"\)/\1.GetBoolArg("-version", false)/g' $(git grep -l '-version') -END VERIFY SCRIPT- Github-Pull: bitcoin#31212 Rebased-From: 6ff9662
1 parent bb42993 commit 397cc86

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

src/bitcoin-cli.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ static int AppInitRPC(int argc, char* argv[])
144144
tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error);
145145
return EXIT_FAILURE;
146146
}
147-
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
147+
if (argc < 2 || HelpRequested(gArgs) || gArgs.GetBoolArg("-version", false)) {
148148
std::string strUsage = PACKAGE_NAME " RPC client version " + FormatFullVersion() + "\n";
149149

150-
if (gArgs.IsArgSet("-version")) {
150+
if (gArgs.GetBoolArg("-version", false)) {
151151
strUsage += FormatParagraph(LicenseInfo());
152152
} else {
153153
strUsage += "\n"

src/bitcoin-tx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ static int AppInitRawTx(int argc, char* argv[])
105105

106106
fCreateBlank = gArgs.GetBoolArg("-create", false);
107107

108-
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
108+
if (argc < 2 || HelpRequested(gArgs) || gArgs.GetBoolArg("-version", false)) {
109109
// First part of help message is specific to this utility
110110
std::string strUsage = PACKAGE_NAME " bitcoin-tx utility version " + FormatFullVersion() + "\n";
111111

112-
if (gArgs.IsArgSet("-version")) {
112+
if (gArgs.GetBoolArg("-version", false)) {
113113
strUsage += FormatParagraph(LicenseInfo());
114114
} else {
115115
strUsage += "\n"

src/bitcoin-util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ static int AppInitUtil(ArgsManager& args, int argc, char* argv[])
5050
return EXIT_FAILURE;
5151
}
5252

53-
if (HelpRequested(args) || args.IsArgSet("-version")) {
53+
if (HelpRequested(args) || args.GetBoolArg("-version", false)) {
5454
// First part of help message is specific to this utility
5555
std::string strUsage = PACKAGE_NAME " bitcoin-util utility version " + FormatFullVersion() + "\n";
5656

57-
if (args.IsArgSet("-version")) {
57+
if (args.GetBoolArg("-version", false)) {
5858
strUsage += FormatParagraph(LicenseInfo());
5959
} else {
6060
strUsage += "\n"

src/bitcoin-wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ static std::optional<int> WalletAppInit(ArgsManager& args, int argc, char* argv[
6060
return EXIT_FAILURE;
6161
}
6262
const bool missing_args{argc < 2};
63-
if (missing_args || HelpRequested(args) || args.IsArgSet("-version")) {
63+
if (missing_args || HelpRequested(args) || args.GetBoolArg("-version", false)) {
6464
std::string strUsage = strprintf("%s bitcoin-wallet version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n";
6565

66-
if (args.IsArgSet("-version")) {
66+
if (args.GetBoolArg("-version", false)) {
6767
strUsage += FormatParagraph(LicenseInfo());
6868
} else {
6969
strUsage += "\n"

src/bitcoind.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ static bool ParseArgs(ArgsManager& args, int argc, char* argv[])
134134
static bool ProcessInitCommands(ArgsManager& args)
135135
{
136136
// Process help and version before taking care about datadir
137-
if (HelpRequested(args) || args.IsArgSet("-version")) {
137+
if (HelpRequested(args) || args.GetBoolArg("-version", false)) {
138138
std::string strUsage = PACKAGE_NAME " version " + FormatFullVersion() + "\n";
139139

140-
if (args.IsArgSet("-version")) {
140+
if (args.GetBoolArg("-version", false)) {
141141
strUsage += FormatParagraph(LicenseInfo());
142142
} else {
143143
strUsage += "\nUsage: bitcoind [options] Start " PACKAGE_NAME "\n"

src/qt/bitcoin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ int GuiMain(int argc, char* argv[])
597597

598598
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
599599
// but before showing splash screen.
600-
if (HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
601-
HelpMessageDialog help(nullptr, gArgs.IsArgSet("-version"));
600+
if (HelpRequested(gArgs) || gArgs.GetBoolArg("-version", false)) {
601+
HelpMessageDialog help(nullptr, gArgs.GetBoolArg("-version", false));
602602
help.showOrPrint();
603603
return EXIT_SUCCESS;
604604
}

0 commit comments

Comments
 (0)