diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-11-22 14:56:29 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-01-10 12:04:54 +0100 |
commit | 481f289765fab47ff2e0bd7dfb968f2bd92fd608 (patch) | |
tree | d7ad238c4842bc4fa6c9a05ae8aef395029d1835 /src/rpc/misc.cpp | |
parent | 9adb4e1a59d54788e204895aaff5d6cbefd1b97a (diff) |
rpc: Named argument support for bitcoin-cli
Usage e.g.:
$ src/bitcoin-cli -testnet -named echo arg0="dfdf"
[
"dfdf"
]
Argument conversion also works, for arguments thus flagged in the table in
`src/rpc/client.cpp`.
$ src/bitcoin-cli -testnet -named echojson arg0="[1,2,3]"
[
[
1,
2,
3
]
]
Unknown parameter (detected server-side):
$ src/bitcoin-cli -testnet -named getinfo arg0="dfdf"
error code: -8
error message:
Unknown named parameter arg0
Diffstat (limited to 'src/rpc/misc.cpp')
-rw-r--r-- | src/rpc/misc.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index e95f422366..01e4dee55b 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -496,8 +496,10 @@ UniValue echo(const JSONRPCRequest& request) { if (request.fHelp) throw runtime_error( - "echo \"message\" ...\n" - "\nSimply echo back the input arguments\n" + "echo|echojson \"message\" ...\n" + "\nSimply echo back the input arguments. This command is for testing.\n" + "\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in" + "bitcoin-cli and the GUI. There is no server-side difference." ); return request.params; @@ -516,6 +518,7 @@ static const CRPCCommand commands[] = /* Not shown in help */ { "hidden", "setmocktime", &setmocktime, true, {"timestamp"}}, { "hidden", "echo", &echo, true, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}}, + { "hidden", "echojson", &echo, true, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}}, }; void RegisterMiscRPCCommands(CRPCTable &t) |