mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 10:12:28 +02:00
scripted-diff: Use ArgsManager::DEBUG_ONLY flag
-BEGIN VERIFY SCRIPT-
sed -i 's/unsigned int flags, const bool debug_only,/unsigned int flags,/' src/util/system.h src/util/system.cpp
sed -i 's/ArgsManager::NONE, debug_only/flags, false/' src/util/system.cpp
sed -i 's/arg.second.m_debug_only/(arg.second.m_flags \& ArgsManager::DEBUG_ONLY)/' src/util/system.cpp
sed -i 's/ArgsManager::ALLOW_ANY, true, OptionsCategory::/ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::/' $(git grep --files-with-matches 'AddArg(' src)
sed -i 's/ArgsManager::ALLOW_ANY, false, OptionsCategory::/ArgsManager::ALLOW_ANY, OptionsCategory::/' $(git grep --files-with-matches 'AddArg(' src)
-END VERIFY SCRIPT-
This commit is contained in:
@@ -539,7 +539,7 @@ void ArgsManager::ForceSetArg(const std::string& strArg, const std::string& strV
|
||||
m_override_args[strArg] = {strValue};
|
||||
}
|
||||
|
||||
void ArgsManager::AddArg(const std::string& name, const std::string& help, unsigned int flags, const bool debug_only, const OptionsCategory& cat)
|
||||
void ArgsManager::AddArg(const std::string& name, const std::string& help, unsigned int flags, const OptionsCategory& cat)
|
||||
{
|
||||
// Split arg name from its help param
|
||||
size_t eq_index = name.find('=');
|
||||
@@ -549,14 +549,14 @@ void ArgsManager::AddArg(const std::string& name, const std::string& help, unsig
|
||||
|
||||
LOCK(cs_args);
|
||||
std::map<std::string, Arg>& arg_map = m_available_args[cat];
|
||||
auto ret = arg_map.emplace(name.substr(0, eq_index), Arg{name.substr(eq_index, name.size() - eq_index), help, ArgsManager::NONE, debug_only});
|
||||
auto ret = arg_map.emplace(name.substr(0, eq_index), Arg{name.substr(eq_index, name.size() - eq_index), help, flags, false});
|
||||
assert(ret.second); // Make sure an insertion actually happened
|
||||
}
|
||||
|
||||
void ArgsManager::AddHiddenArgs(const std::vector<std::string>& names)
|
||||
{
|
||||
for (const std::string& name : names) {
|
||||
AddArg(name, "", ArgsManager::ALLOW_ANY, false, OptionsCategory::HIDDEN);
|
||||
AddArg(name, "", ArgsManager::ALLOW_ANY, OptionsCategory::HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ std::string ArgsManager::GetHelpMessage() const
|
||||
if (arg_map.first == OptionsCategory::HIDDEN) break;
|
||||
|
||||
for (const auto& arg : arg_map.second) {
|
||||
if (show_debug || !arg.second.m_debug_only) {
|
||||
if (show_debug || !(arg.second.m_flags & ArgsManager::DEBUG_ONLY)) {
|
||||
std::string name;
|
||||
if (arg.second.m_help_param.empty()) {
|
||||
name = arg.first;
|
||||
@@ -636,7 +636,7 @@ bool HelpRequested(const ArgsManager& args)
|
||||
|
||||
void SetupHelpOptions(ArgsManager& args)
|
||||
{
|
||||
args.AddArg("-?", "Print this help message and exit", ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS);
|
||||
args.AddArg("-?", "Print this help message and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
||||
args.AddHiddenArgs({"-h", "-help"});
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
/**
|
||||
* Add argument
|
||||
*/
|
||||
void AddArg(const std::string& name, const std::string& help, unsigned int flags, const bool debug_only, const OptionsCategory& cat);
|
||||
void AddArg(const std::string& name, const std::string& help, unsigned int flags, const OptionsCategory& cat);
|
||||
|
||||
/**
|
||||
* Add many hidden arguments
|
||||
|
||||
Reference in New Issue
Block a user