Merge pull request #1662 from girst/listify-tables

listify two-column tables
This commit is contained in:
Alexey Sokolov
2019-06-21 21:52:29 +01:00
committed by GitHub
12 changed files with 28 additions and 1 deletions
+8
View File
@@ -888,6 +888,7 @@ void CClient::UserCommand(CString& sLine) {
CTable Table;
Table.AddColumn(t_s("Name", "listmods"));
Table.AddColumn(t_s("Arguments", "listmods"));
Table.SetStyle(CTable::ListStyle);
for (const CModule* pMod : Modules) {
Table.AddRow();
Table.SetCell(t_s("Name", "listmods"), pMod->GetModName());
@@ -898,6 +899,7 @@ void CClient::UserCommand(CString& sLine) {
if (m_pUser->IsAdmin()) {
const CModules& GModules = CZNC::Get().GetModules();
PutStatus("");
if (!GModules.size()) {
PutStatus(t_s("No global modules loaded."));
} else {
@@ -908,6 +910,7 @@ void CClient::UserCommand(CString& sLine) {
const CModules& UModules = m_pUser->GetModules();
PutStatus("");
if (!UModules.size()) {
PutStatus(t_s("Your user has no modules loaded."));
} else {
@@ -917,6 +920,7 @@ void CClient::UserCommand(CString& sLine) {
if (m_pNetwork) {
const CModules& NetworkModules = m_pNetwork->GetModules();
PutStatus("");
if (NetworkModules.empty()) {
PutStatus(t_s("This network has no modules loaded."));
} else {
@@ -937,6 +941,7 @@ void CClient::UserCommand(CString& sLine) {
CTable Table;
Table.AddColumn(t_s("Name", "listavailmods"));
Table.AddColumn(t_s("Description", "listavailmods"));
Table.SetStyle(CTable::ListStyle);
for (const CModInfo& Info : ssModules) {
Table.AddRow();
@@ -958,6 +963,7 @@ void CClient::UserCommand(CString& sLine) {
CZNC::Get().GetModules().GetAvailableMods(ssGlobalMods,
CModInfo::GlobalModule);
PutStatus("");
if (ssGlobalMods.empty()) {
PutStatus(t_s("No global modules available."));
} else {
@@ -969,6 +975,7 @@ void CClient::UserCommand(CString& sLine) {
set<CModInfo> ssUserMods;
CZNC::Get().GetModules().GetAvailableMods(ssUserMods);
PutStatus("");
if (ssUserMods.empty()) {
PutStatus(t_s("No user modules available."));
} else {
@@ -980,6 +987,7 @@ void CClient::UserCommand(CString& sLine) {
CZNC::Get().GetModules().GetAvailableMods(ssNetworkMods,
CModInfo::NetworkModule);
PutStatus("");
if (ssNetworkMods.empty()) {
PutStatus(t_s("No network modules available."));
} else {
+3 -1
View File
@@ -2019,13 +2019,15 @@ CModCommand::CModCommand(const CString& sCmd, CmdFunc func,
: m_sCmd(sCmd), m_pFunc(std::move(func)), m_Args(Args), m_Desc(Desc) {}
void CModCommand::InitHelp(CTable& Table) {
Table.SetStyle(CTable::ListStyle);
Table.AddColumn(t_s("Command", "modhelpcmd"));
Table.AddColumn(t_s("Description", "modhelpcmd"));
}
void CModCommand::AddHelp(CTable& Table) const {
Table.AddRow();
Table.SetCell(t_s("Command", "modhelpcmd"), GetCommand() + " " + GetArgs());
Table.SetCell(t_s("Command", "modhelpcmd"),
GetCommand() + (GetArgs().empty() ? "" : " ") + GetArgs());
Table.SetCell(t_s("Description", "modhelpcmd"), GetDescription());
}