Skip to content

Commit 6ff9662

Browse files
committed
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-
1 parent e8a2054 commit 6ff9662

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
@@ -145,10 +145,10 @@ static int AppInitRPC(int argc, char* argv[])
145145
tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error);
146146
return EXIT_FAILURE;
147147
}
148-
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
148+
if (argc < 2 || HelpRequested(gArgs) || gArgs.GetBoolArg("-version", false)) {
149149
std::string strUsage = CLIENT_NAME " RPC client version " + FormatFullVersion() + "\n";
150150

151-
if (gArgs.IsArgSet("-version")) {
151+
if (gArgs.GetBoolArg("-version", false)) {
152152
strUsage += FormatParagraph(LicenseInfo());
153153
} else {
154154
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 = CLIENT_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 = CLIENT_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 utility version", CLIENT_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
@@ -135,10 +135,10 @@ static bool ParseArgs(NodeContext& node, int argc, char* argv[])
135135
static bool ProcessInitCommands(ArgsManager& args)
136136
{
137137
// Process help and version before taking care about datadir
138-
if (HelpRequested(args) || args.IsArgSet("-version")) {
138+
if (HelpRequested(args) || args.GetBoolArg("-version", false)) {
139139
std::string strUsage = CLIENT_NAME " daemon version " + FormatFullVersion() + "\n";
140140

141-
if (args.IsArgSet("-version")) {
141+
if (args.GetBoolArg("-version", false)) {
142142
strUsage += FormatParagraph(LicenseInfo());
143143
} else {
144144
strUsage += "\n"

src/qt/bitcoin.cpp

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

583583
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
584584
// but before showing splash screen.
585-
if (HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
586-
HelpMessageDialog help(nullptr, gArgs.IsArgSet("-version"));
585+
if (HelpRequested(gArgs) || gArgs.GetBoolArg("-version", false)) {
586+
HelpMessageDialog help(nullptr, gArgs.GetBoolArg("-version", false));
587587
help.showOrPrint();
588588
return EXIT_SUCCESS;
589589
}

0 commit comments

Comments
 (0)