";
bool web = _webCommands->find(name) != _webCommands->end();
if( web ) ss << "";
ss << name;
if( web ) ss << "";
ss << " | \n";
ss << "";
if (isWriteCommandForConfigServer()) {
ss << "W ";
}
else {
ss << "R ";
}
if( slaveOk() )
ss << "S ";
if( adminOnly() )
ss << "A";
ss << " | ";
ss << "";
if( helpStr != "no help defined" ) {
const char *p = helpStr.c_str();
while( *p ) {
if( *p == '<' ) {
ss << "<";
p++; continue;
}
else if( *p == '{' )
ss << "";
else if( *p == '}' ) {
ss << "} ";
p++;
continue;
}
if( strncmp(p, "http:", 5) == 0 ) {
ss << "";
q = p;
if( str::startsWith(q, "http://www.mongodb.org/display/") )
q += 31;
while( *q && *q != ' ' && *q != '\n' ) {
ss << (*q == '+' ? ' ' : *q);
q++;
if( *q == '#' )
while( *q && *q != ' ' && *q != '\n' ) q++;
}
ss << "";
p = q;
continue;
}
if( *p == '\n' ) ss << " ";
else ss << *p;
p++;
}
}
ss << " | ";
ss << "
\n";
}
Command::Command(StringData _name, bool web, StringData oldName) :
name(_name.toString()),
_commandsExecutedMetric("commands."+ _name.toString()+".total", &_commandsExecuted),
_commandsFailedMetric("commands."+ _name.toString()+".failed", &_commandsFailed) {
// register ourself.
if ( _commands == 0 )
_commands = new CommandMap();
if( _commandsByBestName == 0 )
_commandsByBestName = new CommandMap();
Command*& c = (*_commands)[name];
if ( c )
log() << "warning: 2 commands with name: " << _name << endl;
c = this;
(*_commandsByBestName)[name] = this;
if( web ) {
if( _webCommands == 0 )
_webCommands = new CommandMap();
(*_webCommands)[name] = this;
}
if( !oldName.empty() )
(*_commands)[oldName.toString()] = this;
}
void Command::help( stringstream& help ) const {
help << "no help defined";
}
std::vector