Skip to content

Commit 6b9f45e

Browse files
committed
Support ranges arguments in RPC help
1 parent 7aa6a8a commit 6b9f45e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/rpc/util.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ struct Sections {
200200
case RPCArg::Type::STR:
201201
case RPCArg::Type::NUM:
202202
case RPCArg::Type::AMOUNT:
203+
case RPCArg::Type::RANGE:
203204
case RPCArg::Type::BOOL: {
204205
if (outer_type == OuterType::NAMED_ARG) return; // Nothing more to do for non-recursive types on first recursion
205206
auto left = indent;
@@ -405,6 +406,10 @@ std::string RPCArg::ToDescriptionString() const
405406
ret += "numeric or string";
406407
break;
407408
}
409+
case Type::RANGE: {
410+
ret += "numeric or array";
411+
break;
412+
}
408413
case Type::BOOL: {
409414
ret += "boolean";
410415
break;
@@ -464,6 +469,8 @@ std::string RPCArg::ToStringObj(const bool oneline) const
464469
return res + "\"hex\"";
465470
case Type::NUM:
466471
return res + "n";
472+
case Type::RANGE:
473+
return res + "n or [n,n]";
467474
case Type::AMOUNT:
468475
return res + "amount";
469476
case Type::BOOL:
@@ -494,6 +501,7 @@ std::string RPCArg::ToString(const bool oneline) const
494501
return "\"" + m_name + "\"";
495502
}
496503
case Type::NUM:
504+
case Type::RANGE:
497505
case Type::AMOUNT:
498506
case Type::BOOL: {
499507
return m_name;

src/rpc/util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct RPCArg {
5151
OBJ_USER_KEYS, //!< Special type where the user must set the keys e.g. to define multiple addresses; as opposed to e.g. an options object where the keys are predefined
5252
AMOUNT, //!< Special type representing a floating point amount (can be either NUM or STR)
5353
STR_HEX, //!< Special type that is a STR with only hex chars
54+
RANGE, //!< Special type that is a NUM or [NUM,NUM]
5455
};
5556

5657
enum class Optional {

0 commit comments

Comments
 (0)