Allow wildcards in help command args

Supports the help command for *status, all modules that are using
CModCommand as appropriate, and *controlpanel get/set variables.
This commit is contained in:
J-P Nurmi
2014-09-13 22:33:46 +02:00
parent fab17f903c
commit 69e65ea45e
3 changed files with 11 additions and 7 deletions

View File

@@ -570,14 +570,15 @@ bool CModule::HandleCommand(const CString& sLine) {
}
void CModule::HandleHelpCommand(const CString& sLine) {
CString sFilter = sLine.Token(1);
CString sFilter = sLine.Token(1).AsLower();
CString::size_type iFilterLength = sFilter.size();
CTable Table;
map<CString, CModCommand>::const_iterator it;
CModCommand::InitHelp(Table);
for (it = m_mCommands.begin(); it != m_mCommands.end(); ++it) {
if (sFilter.empty() || (it->second.GetCommand().Equals(sFilter, false, iFilterLength))) {
CString sCmd = it->second.GetCommand().AsLower();
if (sFilter.empty() || (sCmd.Equals(sFilter, true, iFilterLength)) || sCmd.WildCmp(sFilter)) {
it->second.AddHelp(Table);
}
}