From 3c030c8d2b1e6a997ac5a076150a8032d0e4bee9 Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Tue, 1 Mar 2011 23:49:01 +0000 Subject: [PATCH] Use a CTable to list all the commands to be performed in the perform module --- modules/perform.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/modules/perform.cpp b/modules/perform.cpp index a877717d..ed3028a6 100644 --- a/modules/perform.cpp +++ b/modules/perform.cpp @@ -37,16 +37,28 @@ class CPerform : public CModule { } void List(const CString& sCommand) { - int i = 1; + CTable Table; + unsigned int index = 1; CString sExpanded; - for (VCString::const_iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++, i++) { + + Table.AddColumn("Id"); + Table.AddColumn("Perform"); + Table.AddColumn("Expanded"); + + for (VCString::const_iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++, index++) { + Table.AddRow(); + Table.SetCell("Id", CString(index)); + Table.SetCell("Perform", *it); + sExpanded = GetUser()->ExpandString(*it); - if (sExpanded != *it) - PutModule(CString(i) + ": " + *it + " (" + sExpanded + ")"); - else - PutModule(CString(i) + ": " + *it); + if (sExpanded != *it) { + Table.SetCell("Expanded", sExpanded); + } + } + + if (PutModule(Table) == 0) { + PutModule("No commands in your perform list."); } - PutModule(" -- End of List"); } void Execute(const CString& sCommand) {