From a6099ef319a73e2255dca77065600abb22c4f5f8 Mon Sep 17 00:00:00 2001 From: sje Date: Tue, 29 Oct 2013 22:29:44 +1100 Subject: Issue #1865 - Clean up RPC help messages Based on the proposal, update the help message of rpc methods - strings arguments are in double quotes rather than square brackets - numeric arguments have no quotes (and no default value) - optional parameters are surrounded by round brackets - json arguments are strings but don't use double quotes Added 3 sections for the details - Arguments: lists each argument, it's type, required or not, a default, and a description - Result: The method result, with json format if applicable, type, and a description - Examples: examples calls using bitcoin-cli and curl for json rpc call Problems - maybe this is too verbose - lines might be too long - description are not good or complete - examples may be too much --- src/rpcdump.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 8 deletions(-) (limited to 'src/rpcdump.cpp') diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index fe2f4b93b..53cec9a6f 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -71,8 +71,22 @@ Value importprivkey(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 3) throw runtime_error( - "importprivkey [label] [rescan=true]\n" - "Adds a private key (as returned by dumpprivkey) to your wallet."); + "importprivkey \"bitcoinprivkey\" ( \"label\" rescan )\n" + "\nAdds a private key (as returned by dumpprivkey) to your wallet.\n" + "\nArguments:\n" + "1. \"bitcoinprivkey\" (string, required) The private key (see dumpprivkey)\n" + "2. \"label\" (string, optional) an optional label\n" + "3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n" + "\nExamples:\n" + "\nDump a private key\n" + + HelpExampleCli("dumpprivkey", "\"myaddress\"") + + "\nImport the private key\n" + + HelpExampleCli("importprivkey", "\"mykey\"") + + "\nImport using a label\n" + + HelpExampleCli("importprivkey", "\"mykey\" \"testing\" false") + + "\nAs a json rpc call\n" + + HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false") + ); string strSecret = params[0].get_str(); string strLabel = ""; @@ -118,8 +132,18 @@ Value importwallet(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( - "importwallet \n" - "Imports keys from a wallet dump file (see dumpwallet)."); + "importwallet \"filename\"\n" + "\nImports keys from a wallet dump file (see dumpwallet).\n" + "\nArguments:\n" + "1. \"filename\" (string, required) The wallet file\n" + "\nExamples:\n" + "\nDump the wallet\n" + + HelpExampleCli("dumpwallet", "\"test\"") + + "\nImport the wallet\n" + + HelpExampleCli("importwallet", "\"test\"") + + "\nImport using the json rpc call\n" + + HelpExampleRpc("importwallet", "\"test\"") + ); EnsureWalletIsUnlocked(); @@ -198,8 +222,18 @@ Value dumpprivkey(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( - "dumpprivkey \n" - "Reveals the private key corresponding to ."); + "dumpprivkey \"bitcoinaddress\"\n" + "\nReveals the private key corresponding to 'bitcoinaddress'.\n" + "Then the importprivkey can be used with this output\n" + "\nArguments:\n" + "1. \"bitcoinaddress\" (string, required) The bitcoin address for the private key\n" + "\nResult:\n" + "\"key\" (string) The private key\n" + "\nExamples:\n" + + HelpExampleCli("dumpprivkey", "\"myaddress\"") + + HelpExampleCli("importprivkey", "\"mykey\"") + + HelpExampleRpc("dumpprivkey", "\"myaddress\"") + ); EnsureWalletIsUnlocked(); @@ -221,8 +255,14 @@ Value dumpwallet(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( - "dumpwallet \n" - "Dumps all wallet keys in a human-readable format."); + "dumpwallet \"filename\"\n" + "\nDumps all wallet keys in a human-readable format.\n" + "\nArguments:\n" + "1. \"filename\" (string, required) The filename\n" + "\nExamples:\n" + + HelpExampleCli("dumpwallet", "\"test\"") + + HelpExampleRpc("dumpwallet", "\"test\"") + ); EnsureWalletIsUnlocked(); -- cgit v1.2.3