Skip to content
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

refactor: Add ALLOW_LIST flags and enforce usage in CheckArgFlags #17580

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
common: Grammar / formatting tweaks
Implement cleanup suggestions from l0rinc:

#16545 (comment)
#16545 (comment)
#16545 (comment)
  • Loading branch information
ryanofsky committed Sep 25, 2024
commit 20a9986751785d3047cfd87fa82c4b05a2e82b41
6 changes: 3 additions & 3 deletions src/common/args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ KeyInfo InterpretKey(std::string key)
* @param[in] flags ArgsManager registered argument flags
* @param[out] error Error description if settings value is not valid
*
* @return parsed settings value if it is valid, otherwise nullopt accompanied
* @return parsed settings value if it is valid, otherwise `nullopt` accompanied
* by a descriptive error string
*/
std::optional<common::SettingsValue> InterpretValue(const KeyInfo& key, const std::string* value,
unsigned int flags, std::string& error)
unsigned int flags, std::string& error)
{
// Return negated settings as false values.
if (key.negated) {
Expand All @@ -121,7 +121,7 @@ std::optional<common::SettingsValue> InterpretValue(const KeyInfo& key, const st
return false;
}
if (!value && (flags & ArgsManager::DISALLOW_ELISION)) {
error = strprintf("Can not set -%s with no value. Please specify value with -%s=value.", key.name, key.name);
error = strprintf("Cannot set -%s with no value. Please specify value with -%s=value.", key.name, key.name);
return std::nullopt;
}
return value ? *value : "";
Expand Down
2 changes: 1 addition & 1 deletion test/functional/feature_config_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_config_file_log(self):

def test_invalid_command_line_options(self):
self.nodes[0].assert_start_raises_init_error(
expected_msg='Error: Error parsing command line arguments: Can not set -proxy with no value. Please specify value with -proxy=value.',
expected_msg='Error: Error parsing command line arguments: Cannot set -proxy with no value. Please specify value with -proxy=value.',
extra_args=['-proxy'],
)
# Provide a value different from 1 to the -wallet negated option
Expand Down