Add support for boost command line options in prep for unit tests.

This commit is contained in:
Arthur Britto
2012-05-02 17:35:28 -07:00
parent f775bfd856
commit c6f6914dab
3 changed files with 67 additions and 43 deletions

View File

@@ -46,27 +46,20 @@ std::string EncodeBase64(const std::string& s)
return result;
}
int commandLineRPC(int argc, char *argv[])
int commandLineRPC(const std::vector<std::string>& vCmd)
{
std::string strPrint;
int nRet = 0;
try
{
// Skip switches
while ((argc > 1) && isSwitchChar(argv[1][0]))
{
argc--;
argv++;
}
if (vCmd.size() < 2) return 1;
if (argc < 2) return 0;
std::string strMethod = argv[1];
std::string strMethod = vCmd[0];
// Parameters default to strings
Json::Value params(Json::arrayValue);
for (int i = 2; i < argc; i++)
params.append(argv[i]);
for (int i = 1; i != vCmd.size(); i++)
params.append(vCmd[i]);
// Execute
Json::Value reply = callRPC(strMethod, params);