aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/server.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-01-29 09:55:37 -0500
committerMarcoFalke <falke.marco@gmail.com>2019-01-29 09:55:48 -0500
commit7275365c9bc7e7ebd6bbf7dcb251946aac44b5de (patch)
treed0ab0c3a0c52e09ce6fe2a68160afa0bab3a3f1b /src/rpc/server.cpp
parentd6e700e40f861ddd6743f4d13f0d6f6bc19093c2 (diff)
parentfaa1522e5ec5ec53b2b2b1ed36c11e84939bbb13 (diff)
downloadbitcoin-7275365c9bc7e7ebd6bbf7dcb251946aac44b5de.tar.xz
Merge #14987: RPCHelpMan: Pass through Result and Examples
faa1522e5e RPCHelpMan: Pass through Result and Examples (MarcoFalke) Pull request description: Passing the rpc result and rpc examples through `RPCHelpMan` makes it clear in what order they appear in the stringified version. Future improvements could then autoformat or autogenerate them. Tree-SHA512: b32a5c178cc80f50a7e9b93a38e2b26d5994188ecafe9e61bbc599941b44b9b0e4e4be6413d4464fac6e8e73661a191a77d34917f2e6293de19fb59519dd4487
Diffstat (limited to 'src/rpc/server.cpp')
-rw-r--r--src/rpc/server.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp
index 00187931e7..2ed74547b9 100644
--- a/src/rpc/server.cpp
+++ b/src/rpc/server.cpp
@@ -231,10 +231,12 @@ UniValue help(const JSONRPCRequest& jsonRequest)
"\nList all commands, or get help for a specified command.\n",
{
{"command", RPCArg::Type::STR, /* opt */ true, /* default_val */ "all commands", "The command to get help on"},
- }}
- .ToString() +
- "\nResult:\n"
+ },
+ RPCResult{
"\"text\" (string) The help text\n"
+ },
+ RPCExamples{""},
+ }.ToString()
);
std::string strCommand;
@@ -254,8 +256,11 @@ UniValue stop(const JSONRPCRequest& jsonRequest)
if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
throw std::runtime_error(
RPCHelpMan{"stop",
- "\nStop Bitcoin server.", {}}
- .ToString());
+ "\nStop Bitcoin server.",
+ {},
+ RPCResults{},
+ RPCExamples{""},
+ }.ToString());
// Event loop will exit after current HTTP requests have been handled, so
// this reply will get back to the client.
StartShutdown();
@@ -270,14 +275,16 @@ static UniValue uptime(const JSONRPCRequest& jsonRequest)
if (jsonRequest.fHelp || jsonRequest.params.size() > 0)
throw std::runtime_error(
RPCHelpMan{"uptime",
- "\nReturns the total uptime of the server.\n", {}}
- .ToString() +
- "\nResult:\n"
+ "\nReturns the total uptime of the server.\n",
+ {},
+ RPCResult{
"ttt (numeric) The number of seconds that the server has been running\n"
- "\nExamples:\n"
- + HelpExampleCli("uptime", "")
+ },
+ RPCExamples{
+ HelpExampleCli("uptime", "")
+ HelpExampleRpc("uptime", "")
- );
+ },
+ }.ToString());
return GetTime() - GetStartupTime();
}
@@ -287,8 +294,11 @@ static UniValue getrpcinfo(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 0) {
throw std::runtime_error(
RPCHelpMan{"getrpcinfo",
- "\nReturns details of the RPC server.\n", {}}
- .ToString()
+ "\nReturns details of the RPC server.\n",
+ {},
+ RPCResults{},
+ RPCExamples{""},
+ }.ToString()
);
}