Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/util.cpp
Show First 20 Lines • Show All 517 Lines • ▼ Show 20 Lines | |||||
std::string RPCHelpMan::ToString() const { | std::string RPCHelpMan::ToString() const { | ||||
std::string ret; | std::string ret; | ||||
// Oneline summary | // Oneline summary | ||||
ret += m_name; | ret += m_name; | ||||
bool was_optional{false}; | bool was_optional{false}; | ||||
for (const auto &arg : m_args) { | for (const auto &arg : m_args) { | ||||
if (arg.m_hidden) { | if (arg.m_hidden) { | ||||
continue; | // Any arg that follows is also hidden | ||||
break; | |||||
} | } | ||||
const bool optional = arg.IsOptional(); | const bool optional = arg.IsOptional(); | ||||
ret += " "; | ret += " "; | ||||
if (optional) { | if (optional) { | ||||
if (!was_optional) { | if (!was_optional) { | ||||
ret += "( "; | ret += "( "; | ||||
} | } | ||||
was_optional = true; | was_optional = true; | ||||
Show All 13 Lines | std::string RPCHelpMan::ToString() const { | ||||
// Description | // Description | ||||
ret += m_description; | ret += m_description; | ||||
// Arguments | // Arguments | ||||
Sections sections; | Sections sections; | ||||
for (size_t i{0}; i < m_args.size(); ++i) { | for (size_t i{0}; i < m_args.size(); ++i) { | ||||
const auto &arg = m_args.at(i); | const auto &arg = m_args.at(i); | ||||
if (arg.m_hidden) { | if (arg.m_hidden) { | ||||
continue; | // Any arg that follows is also hidden | ||||
break; | |||||
} | } | ||||
if (i == 0) { | if (i == 0) { | ||||
ret += "\nArguments:\n"; | ret += "\nArguments:\n"; | ||||
} | } | ||||
// Push named argument name and description | // Push named argument name and description | ||||
sections.m_sections.emplace_back(::ToString(i + 1) + ". " + | sections.m_sections.emplace_back(::ToString(i + 1) + ". " + | ||||
▲ Show 20 Lines • Show All 373 Lines • Show Last 20 Lines |