CmdContext: Migrated from ViewText to Table
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
#include <CmdContext.h>
|
#include <CmdContext.h>
|
||||||
#include <CmdConfig.h>
|
#include <CmdConfig.h>
|
||||||
|
#include <Table.h>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
#include <Filter.h>
|
#include <Filter.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -218,16 +219,16 @@ void CmdContext::listContexts (std::stringstream& out)
|
|||||||
{
|
{
|
||||||
std::sort (contexts.begin (), contexts.end ());
|
std::sort (contexts.begin (), contexts.end ());
|
||||||
|
|
||||||
ViewText view;
|
Table table;
|
||||||
view.width (context.getWidth ());
|
table.width (context.getWidth ());
|
||||||
view.add (Column::factory ("string", "Name"));
|
table.add ("Name");
|
||||||
view.add (Column::factory ("string", "Definition"));
|
table.add ("Definition");
|
||||||
view.add (Column::factory ("string", "Active"));
|
table.add ("Active");
|
||||||
|
|
||||||
if (context.color ())
|
if (context.color ())
|
||||||
{
|
{
|
||||||
Color label (context.config.get ("color.label"));
|
Color label (context.config.get ("color.label"));
|
||||||
view.colorHeader (label);
|
table.colorHeader (label);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string activeContext = context.config.get ("context");
|
std::string activeContext = context.config.get ("context");
|
||||||
@@ -238,14 +239,14 @@ void CmdContext::listContexts (std::stringstream& out)
|
|||||||
if (userContext == activeContext)
|
if (userContext == activeContext)
|
||||||
active = "yes";
|
active = "yes";
|
||||||
|
|
||||||
int row = view.addRow ();
|
int row = table.addRow ();
|
||||||
view.set (row, 0, userContext);
|
table.set (row, 0, userContext);
|
||||||
view.set (row, 1, context.config.get ("context." + userContext));
|
table.set (row, 1, context.config.get ("context." + userContext));
|
||||||
view.set (row, 2, active);
|
table.set (row, 2, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
out << optionalBlankLine ()
|
out << optionalBlankLine ()
|
||||||
<< view.render ()
|
<< table.render ()
|
||||||
<< optionalBlankLine ();
|
<< optionalBlankLine ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user