-
Notifications
You must be signed in to change notification settings - Fork 37.7k
CLI: Only one Request Handler can be specified. #27815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…sible to specify multiple, however only one was picked in this arbitrary and (probably) undocumented priority: getinfo > netinfo > generate > addrinfo.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
int nRh = 0; | ||
if (gArgs.IsArgSet("-getinfo")) nRh++; | ||
if (gArgs.GetBoolArg("-netinfo", false)) nRh++; | ||
if (gArgs.GetBoolArg("-generate", false)) nRh++; | ||
if (gArgs.GetBoolArg("-addrinfo", false)) nRh++; | ||
if (nRh > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int nRh = 0; | |
if (gArgs.IsArgSet("-getinfo")) nRh++; | |
if (gArgs.GetBoolArg("-netinfo", false)) nRh++; | |
if (gArgs.GetBoolArg("-generate", false)) nRh++; | |
if (gArgs.GetBoolArg("-addrinfo", false)) nRh++; | |
if (nRh > 1) { | |
if (gArgs.IsArgSet("-getinfo") + gArgs.GetBoolArg("-netinfo", false) + gArgs.GetBoolArg("-generate", false) + gArgs.GetBoolArg("-addrinfo", false) > 1) { |
This is admittedly a bit obscure, so maybe there's a better way (but it's still an improvement over the temporary variable IMO)
nit: Commit summary is too long. Would also be nice to rebase on top of 42af959 |
…sible to specify multiple, however only one was picked in this arbitrary and (probably) undocumented priority: getinfo > netinfo > generate > addrinfo. Github-Pull: bitcoin#27815 Rebased-From: 244e6c8
Concept ACK. I agree this validation should be put in place, please check #26990 if you haven't already, in the second commit 11e0a80 there's a function that already does this ( As pointed out by @luke-jr please check the project guidelines regarding commits specifications. Also, for future reference, check the guidelines regarding C++ coding style and naming conventions (e.g. Thanks for working on this! |
Are you still working on this? |
…oin-cli c8e6771 test: restrict multiple CLI arguments (naiyoma) 8838c4f common/args.h: automate check for multiple cli commands (naiyoma) Pull request description: This PR is a continuation of the validation suggested [here](#27815) to ensure that only one Request Handler can be specified at a time. ACKs for top commit: stratospher: reACK c8e6771. achow101: ACK c8e6771 tdb3: cr re ACK c8e6771 Tree-SHA512: f4fe036fee342a54f1a7ac702ac35c40bf3d420fde6ab16313a75327292d5ee5c8ece1be9f852a13fcf73da1148b143b37b4894e294052abdde6eefb2e8c6f3f
Previously it was possible to specify multiple, however only one was picked in this arbitrary and (probably) undocumented priority: getinfo > netinfo > generate > addrinfo.