diff --git a/src/rpc/util.h b/src/rpc/util.h --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -176,6 +176,7 @@ //! aliases separated by | for named request arguments) const std::string m_names; const Type m_type; + const bool m_hidden; //! Only used for arrays or dicts const std::vector m_inner; const Fallback m_fallback; @@ -194,8 +195,9 @@ RPCArg(const std::string name, const Type type, const Fallback fallback, const std::string description, const std::string oneline_description = "", - const std::vector type_str = {}) - : m_names{std::move(name)}, m_type{std::move(type)}, + const std::vector type_str = {}, + const bool hidden = false) + : m_names{std::move(name)}, m_type{std::move(type)}, m_hidden{hidden}, m_fallback{std::move(fallback)}, m_description{std::move( description)}, m_oneline_description{std::move(oneline_description)}, @@ -207,10 +209,9 @@ const std::string description, const std::vector inner, const std::string oneline_description = "", const std::vector type_str = {}) - : m_names{std::move(name)}, m_type{std::move(type)}, m_inner{std::move( - inner)}, - m_fallback{std::move(fallback)}, m_description{std::move( - description)}, + : m_names{std::move(name)}, m_type{std::move(type)}, m_hidden{false}, + m_inner{std::move(inner)}, m_fallback{std::move(fallback)}, + m_description{std::move(description)}, m_oneline_description{std::move(oneline_description)}, m_type_str{std::move(type_str)} { CHECK_NONFATAL(type == Type::ARR || type == Type::OBJ); diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -405,9 +405,7 @@ {indent + "]" + (outer_type != OuterType::NONE ? "," : ""), ""}); break; - } - - // no default case, so the compiler can warn about missing cases + } // no default case, so the compiler can warn about missing cases } } @@ -524,6 +522,9 @@ ret += m_name; bool was_optional{false}; for (const auto &arg : m_args) { + if (arg.m_hidden) { + continue; + } const bool optional = arg.IsOptional(); ret += " "; if (optional) { @@ -551,6 +552,9 @@ Sections sections; for (size_t i{0}; i < m_args.size(); ++i) { const auto &arg = m_args.at(i); + if (arg.m_hidden) { + continue; + } if (i == 0) { ret += "\nArguments:\n"; @@ -630,9 +634,7 @@ case Type::ARR: { ret += "json array"; break; - } - - // no default case, so the compiler can warn about missing cases + } // no default case, so the compiler can warn about missing cases } } if (m_fallback.which() == 1) { @@ -651,9 +653,7 @@ case RPCArg::Optional::NO: { ret += ", required"; break; - } - - // no default case, so the compiler can warn about missing cases + } // no default case, so the compiler can warn about missing cases } } ret += ")"; @@ -762,11 +762,8 @@ } sections.PushSection({indent + "}" + maybe_separator, ""}); return; - } - - // no default case, so the compiler can warn about missing cases + } // no default case, so the compiler can warn about missing cases } - CHECK_NONFATAL(false); } @@ -841,9 +838,7 @@ res += i.ToString(oneline) + ","; } return "[" + res + "...]"; - } - - // no default case, so the compiler can warn about missing cases + } // no default case, so the compiler can warn about missing cases } CHECK_NONFATAL(false); }