|
|
@ -123,11 +123,9 @@ bool pfConsoleEngine::PrintCmdHelp( char *name, void (*PrintFn)( const char * |
|
|
|
pfConsoleCmd *cmd; |
|
|
|
pfConsoleCmd *cmd; |
|
|
|
pfConsoleCmdGroup *group, *subGrp; |
|
|
|
pfConsoleCmdGroup *group, *subGrp; |
|
|
|
const char *ptr; |
|
|
|
const char *ptr; |
|
|
|
static char string[ 512 ]; |
|
|
|
|
|
|
|
static char tempString[ 512 ]; |
|
|
|
static char tempString[ 512 ]; |
|
|
|
uint32_t i; |
|
|
|
uint32_t i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Scan for subgroups. This can be an empty loop
|
|
|
|
/// Scan for subgroups. This can be an empty loop
|
|
|
|
group = pfConsoleCmdGroup::GetBaseGroup(); |
|
|
|
group = pfConsoleCmdGroup::GetBaseGroup(); |
|
|
|
ptr = console_strtok( name, false ); |
|
|
|
ptr = console_strtok( name, false ); |
|
|
@ -152,17 +150,15 @@ bool pfConsoleEngine::PrintCmdHelp( char *name, void (*PrintFn)( const char * |
|
|
|
|
|
|
|
|
|
|
|
// Print help for this group
|
|
|
|
// Print help for this group
|
|
|
|
if( group == pfConsoleCmdGroup::GetBaseGroup() ) |
|
|
|
if( group == pfConsoleCmdGroup::GetBaseGroup() ) |
|
|
|
strcpy( string, "Base commands and groups:" ); |
|
|
|
PrintFn("Base commands and groups:"); |
|
|
|
else |
|
|
|
else |
|
|
|
sprintf( string, "Group %s:", group->GetName() ); |
|
|
|
PrintFn(plString::Format("Group %s:", group->GetName()).c_str()); |
|
|
|
PrintFn( string ); |
|
|
|
PrintFn(" Subgroups:"); |
|
|
|
PrintFn( " Subgroups:" ); |
|
|
|
|
|
|
|
for( subGrp = group->GetFirstSubGroup(); subGrp != nil; subGrp = subGrp->GetNext() ) |
|
|
|
for( subGrp = group->GetFirstSubGroup(); subGrp != nil; subGrp = subGrp->GetNext() ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
sprintf( string, " %s", subGrp->GetName() ); |
|
|
|
PrintFn(plString::Format(" %s", subGrp).c_str()); |
|
|
|
PrintFn( string ); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
PrintFn( " Commands:" ); |
|
|
|
PrintFn(" Commands:"); |
|
|
|
for( cmd = group->GetFirstCommand(); cmd != nil; cmd = cmd->GetNext() ) |
|
|
|
for( cmd = group->GetFirstCommand(); cmd != nil; cmd = cmd->GetNext() ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char* p = cmd->GetHelp(); |
|
|
|
const char* p = cmd->GetHelp(); |
|
|
@ -171,8 +167,7 @@ bool pfConsoleEngine::PrintCmdHelp( char *name, void (*PrintFn)( const char * |
|
|
|
} |
|
|
|
} |
|
|
|
tempString[ i ] = 0; |
|
|
|
tempString[ i ] = 0; |
|
|
|
|
|
|
|
|
|
|
|
sprintf( string, " %s: %s", cmd->GetName(), tempString ); |
|
|
|
PrintFn(plString::Format(" %s: %s", cmd->GetName(), tempString).c_str()); |
|
|
|
PrintFn( string ); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -187,11 +182,9 @@ bool pfConsoleEngine::PrintCmdHelp( char *name, void (*PrintFn)( const char * |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// That's it!
|
|
|
|
/// That's it!
|
|
|
|
plStringStream ss; |
|
|
|
PrintFn(plString::Format("\nHelp for the command %s:", cmd->GetName()).c_str()); |
|
|
|
ss << "\nHelp for the command " << cmd->GetName() << ":\n"; |
|
|
|
PrintFn(plString::Format("\\i%s", cmd->GetHelp()).c_str()); |
|
|
|
ss << "\\i" << cmd->GetHelp() << "\n"; |
|
|
|
PrintFn(plString::Format("\\iUsage: %s", cmd->GetSignature()).c_str()); |
|
|
|
ss << "\\iUsage: " << cmd->GetSignature(); |
|
|
|
|
|
|
|
PrintFn(ss.GetString().c_str()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|