Changeset 5204 in orxonox.OLD for trunk/src/lib/shell/shell_command.cc
- Timestamp:
- Sep 18, 2005, 1:37:58 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r5203 r5204 212 212 ShellCommandClass::commandClassList = new tList<ShellCommandClass>; 213 213 ShellCommand<ShellCommandBase>::registerCommand("debug", "ShellCommand", &ShellCommandBase::debugDyn); 214 } 215 } 216 217 void ShellCommandClass::help(const char* className) 218 { 219 if (className == NULL) 220 return; 221 if (likely(ShellCommandClass::commandClassList != NULL)) 222 { 223 tIterator<ShellCommandClass>* itCL = ShellCommandClass::commandClassList->getIterator(); 224 ShellCommandClass* elemCL = itCL->firstElement(); 225 while(elemCL != NULL) 226 { 227 if (elemCL->className && !strcasecmp(className, elemCL->className)) 228 { 229 PRINT(0)("Class:'%s' registered %d commands: \n", elemCL->className, elemCL->commandList->getSize()); 230 tIterator<ShellCommandBase>* iterator = elemCL->commandList->getIterator(); 231 const ShellCommandBase* elem = iterator->firstElement(); 232 while(elem != NULL) 233 { 234 PRINT(0)(" command:'%s' : params:%d: ", elem->getName(), elem->paramCount); 235 for (unsigned int i = 0; i< elem->paramCount; i++) 236 PRINT(0)("%s ", ShellCommandBase::paramToString(elem->parameters[i])); 237 if (elem->description != NULL) 238 PRINT(0)("- %s", elem->description); 239 PRINT(0)("\n"); 240 elem = iterator->nextElement(); 241 } 242 delete iterator; 243 244 delete itCL; 245 return; 246 } 247 elemCL = itCL->nextElement(); 248 } 249 delete itCL; 250 PRINTF(3)("Class %s not found in Command's classes\n", className); 251 } 252 else 253 { 254 PRINTF(1)("List of commandClasses does not exist"); 214 255 } 215 256 } … … 413 454 if (objectList != NULL) 414 455 { 415 elemAL->getCommand()->executeCommand(objectList->firstElement(), executionString+inputSplits.getOffset(1)); 456 if (inputSplits.getCount() > 1) 457 elemAL->getCommand()->executeCommand(objectList->firstElement(), executionString+inputSplits.getOffset(1)); 458 else 459 elemAL->getCommand()->executeCommand(objectList->firstElement(), ""); 416 460 delete itAL; 417 461 return true; … … 441 485 delete itCL; 442 486 } 443 444 487 445 488 if (classID != CL_NULL && inputSplits.getCount() >= 2 && objectList != NULL) … … 484 527 } 485 528 delete itCMD; 486 487 } 488 489 } 490 491 492 } 493 529 } 530 } 531 } 494 532 } 495 533
Note: See TracChangeset
for help on using the changeset viewer.