src/bitcoinrpc.cpp
///
/// Note: This interface may still be subject to change.
///
This interface may still be subject to change.
This interface may still be subject to change .
Value help(const Array& params, bool fHelp)
{
    if (fHelp || params.size() > 1)
        throw runtime_error(
            "help [command]\n"
            "List commands, or get help for a command.");
    string strCommand;
    if (params.size() > 0)
        strCommand = params[0].get_str();
    string strRet;
    set<rpcfn_type> setDone;
    for (map<string, rpcfn_type>::iterator mi = mapCallTable.begin(); mi != mapCallTable.end(); ++mi)
    {
        string strMethod = (*mi).first;
        if (strMethod == "getamountreceived" ||
            strMethod == "getallreceived" ||
            (strMethod.find("label") != string::npos))
            continue;
        if (strCommand != "" && strMethod != strCommand)
            continue;
        try
        {
            Array params;
            rpcfn_type pfn = (*mi).second;
            if (setDone.insert(pfn).second)
                (*pfn)(params, true);
        }
        catch (std::exception& e)
        {
            string strHelp = string(e.what());
            if (strCommand == "")
                if (strHelp.find('\n') != -1)
                    strHelp = strHelp.substr(0, strHelp.find('\n'));
            strRet += strHelp + "\n";
        }
    }
    if (strRet == "")
        strRet = strprintf("help: unknown command: %s\n", strCommand.c_str());
    strRet = strRet.substr(0,strRet.size()-1);
    return strRet;
}
Value help ( const Array & params , bool fHelp ) { if ( fHelp || params . size ( ) > 1 ) throw runtime_error ( " \n " " " ) ; string strCommand ; if ( params . size ( ) > 0 ) strCommand = params [ 0 ] . get_str ( ) ; string strRet ; set < rpcfn_type > setDone ; for ( map < string , rpcfn_type > :: iterator mi = mapCallTable . begin ( ) ; mi != mapCallTable . end ( ) ; ++ mi ) { string strMethod = ( * mi ) . first ; if ( strMethod == " " || strMethod == " " || ( strMethod . find ( " " ) != string :: npos ) ) continue ; if ( strCommand != " " && strMethod != strCommand ) continue ; try { Array params ; rpcfn_type pfn = ( * mi ) . second ; if ( setDone . insert ( pfn ) . second ) ( * pfn ) ( params , true ) ; } catch ( std :: exception & e ) { string strHelp = string ( e . what ( ) ) ; if ( strCommand == " " ) if ( strHelp . find ( ' \n ' ) != -1 ) strHelp = strHelp . substr ( 0 , strHelp . find ( ' \n ' ) ) ; strRet += strHelp + " \n " ; } } if ( strRet == " " ) strRet = strprintf ( " \n " , strCommand . c_str ( ) ) ; strRet = strRet . substr ( 0 , strRet . size ( ) - 1 ) ; return strRet ; }
Note: This interface may still be subject to change.
Note : This interface may still be subject to change .
// We already filter duplicates, but these deprecated screw up the sort order // Help text is returned in an exception