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-
This commit is contained in:
Hodlinator 2024-11-20 22:55:23 +01:00
parent e8a2054edc
commit 6ff9662760
No known key found for this signature in database
6 changed files with 12 additions and 12 deletions

View file

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

View file

@ -105,11 +105,11 @@ static int AppInitRawTx(int argc, char* argv[])
fCreateBlank = gArgs.GetBoolArg("-create", false);
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
if (argc < 2 || HelpRequested(gArgs) || gArgs.GetBoolArg("-version", false)) {
// First part of help message is specific to this utility
std::string strUsage = CLIENT_NAME " bitcoin-tx utility version " + FormatFullVersion() + "\n";
if (gArgs.IsArgSet("-version")) {
if (gArgs.GetBoolArg("-version", false)) {
strUsage += FormatParagraph(LicenseInfo());
} else {
strUsage += "\n"

View file

@ -50,11 +50,11 @@ static int AppInitUtil(ArgsManager& args, int argc, char* argv[])
return EXIT_FAILURE;
}
if (HelpRequested(args) || args.IsArgSet("-version")) {
if (HelpRequested(args) || args.GetBoolArg("-version", false)) {
// First part of help message is specific to this utility
std::string strUsage = CLIENT_NAME " bitcoin-util utility version " + FormatFullVersion() + "\n";
if (args.IsArgSet("-version")) {
if (args.GetBoolArg("-version", false)) {
strUsage += FormatParagraph(LicenseInfo());
} else {
strUsage += "\n"

View file

@ -60,10 +60,10 @@ static std::optional<int> WalletAppInit(ArgsManager& args, int argc, char* argv[
return EXIT_FAILURE;
}
const bool missing_args{argc < 2};
if (missing_args || HelpRequested(args) || args.IsArgSet("-version")) {
if (missing_args || HelpRequested(args) || args.GetBoolArg("-version", false)) {
std::string strUsage = strprintf("%s bitcoin-wallet utility version", CLIENT_NAME) + " " + FormatFullVersion() + "\n";
if (args.IsArgSet("-version")) {
if (args.GetBoolArg("-version", false)) {
strUsage += FormatParagraph(LicenseInfo());
} else {
strUsage += "\n"

View file

@ -135,10 +135,10 @@ static bool ParseArgs(NodeContext& node, int argc, char* argv[])
static bool ProcessInitCommands(ArgsManager& args)
{
// Process help and version before taking care about datadir
if (HelpRequested(args) || args.IsArgSet("-version")) {
if (HelpRequested(args) || args.GetBoolArg("-version", false)) {
std::string strUsage = CLIENT_NAME " daemon version " + FormatFullVersion() + "\n";
if (args.IsArgSet("-version")) {
if (args.GetBoolArg("-version", false)) {
strUsage += FormatParagraph(LicenseInfo());
} else {
strUsage += "\n"

View file

@ -582,8 +582,8 @@ int GuiMain(int argc, char* argv[])
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
// but before showing splash screen.
if (HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
HelpMessageDialog help(nullptr, gArgs.IsArgSet("-version"));
if (HelpRequested(gArgs) || gArgs.GetBoolArg("-version", false)) {
HelpMessageDialog help(nullptr, gArgs.GetBoolArg("-version", false));
help.showOrPrint();
return EXIT_SUCCESS;
}