mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
rpc: Set RPCArg options with designated initializers
This commit is contained in:
@@ -418,8 +418,8 @@ struct Sections {
|
||||
case RPCArg::Type::BOOL: {
|
||||
if (outer_type == OuterType::NONE) return; // Nothing more to do for non-recursive types on first recursion
|
||||
auto left = indent;
|
||||
if (arg.m_type_str.size() != 0 && push_name) {
|
||||
left += "\"" + arg.GetName() + "\": " + arg.m_type_str.at(0);
|
||||
if (arg.m_opts.type_str.size() != 0 && push_name) {
|
||||
left += "\"" + arg.GetName() + "\": " + arg.m_opts.type_str.at(0);
|
||||
} else {
|
||||
left += push_name ? arg.ToStringObj(/*oneline=*/false) : arg.ToString(/*oneline=*/false);
|
||||
}
|
||||
@@ -618,7 +618,7 @@ std::string RPCHelpMan::ToString() const
|
||||
ret += m_name;
|
||||
bool was_optional{false};
|
||||
for (const auto& arg : m_args) {
|
||||
if (arg.m_hidden) break; // Any arg that follows is also hidden
|
||||
if (arg.m_opts.hidden) break; // Any arg that follows is also hidden
|
||||
const bool optional = arg.IsOptional();
|
||||
ret += " ";
|
||||
if (optional) {
|
||||
@@ -639,7 +639,7 @@ std::string RPCHelpMan::ToString() const
|
||||
Sections sections;
|
||||
for (size_t i{0}; i < m_args.size(); ++i) {
|
||||
const auto& arg = m_args.at(i);
|
||||
if (arg.m_hidden) break; // Any arg that follows is also hidden
|
||||
if (arg.m_opts.hidden) break; // Any arg that follows is also hidden
|
||||
|
||||
if (i == 0) ret += "\nArguments:\n";
|
||||
|
||||
@@ -704,8 +704,8 @@ std::string RPCArg::ToDescriptionString() const
|
||||
{
|
||||
std::string ret;
|
||||
ret += "(";
|
||||
if (m_type_str.size() != 0) {
|
||||
ret += m_type_str.at(1);
|
||||
if (m_opts.type_str.size() != 0) {
|
||||
ret += m_opts.type_str.at(1);
|
||||
} else {
|
||||
switch (m_type) {
|
||||
case Type::STR_HEX:
|
||||
@@ -991,7 +991,7 @@ std::string RPCArg::ToStringObj(const bool oneline) const
|
||||
|
||||
std::string RPCArg::ToString(const bool oneline) const
|
||||
{
|
||||
if (oneline && !m_oneline_description.empty()) return m_oneline_description;
|
||||
if (oneline && !m_opts.oneline_description.empty()) return m_opts.oneline_description;
|
||||
|
||||
switch (m_type) {
|
||||
case Type::STR_HEX:
|
||||
|
||||
Reference in New Issue
Block a user