Display the active context when listing known contexts
This commit is contained in:
@@ -6,6 +6,7 @@ Harlan).
|
|||||||
- TW-1432 start/stop can be issued on completed tasks (thanks to Renato Alves).
|
- TW-1432 start/stop can be issued on completed tasks (thanks to Renato Alves).
|
||||||
- TW-1572 Better urgency inheritance (thanks to Jens Erat).
|
- TW-1572 Better urgency inheritance (thanks to Jens Erat).
|
||||||
- Prevent potential task duplication during import for non-pending tasks.
|
- Prevent potential task duplication during import for non-pending tasks.
|
||||||
|
- Show the active context in "context list", if any is active.
|
||||||
|
|
||||||
------ current release ---------------------------
|
------ current release ---------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -241,17 +241,26 @@ int CmdContext::listContexts (std::vector <std::string>& words, std::stringstrea
|
|||||||
view.width (context.getWidth ());
|
view.width (context.getWidth ());
|
||||||
view.add (Column::factory ("string", "Name"));
|
view.add (Column::factory ("string", "Name"));
|
||||||
view.add (Column::factory ("string", "Definition"));
|
view.add (Column::factory ("string", "Definition"));
|
||||||
|
view.add (Column::factory ("string", "Active"));
|
||||||
|
|
||||||
Color label (context.config.get ("color.label"));
|
Color label (context.config.get ("color.label"));
|
||||||
view.colorHeader (label);
|
view.colorHeader (label);
|
||||||
|
|
||||||
|
std::string activeContext = context.config.get ("context");
|
||||||
|
|
||||||
for (auto& userContext : contexts)
|
for (auto& userContext : contexts)
|
||||||
{
|
{
|
||||||
std::string definition = context.config.get ("context." + userContext);
|
std::string definition = context.config.get ("context." + userContext);
|
||||||
|
|
||||||
|
std::string active = "no";
|
||||||
|
|
||||||
|
if (userContext == activeContext)
|
||||||
|
active = "yes";
|
||||||
|
|
||||||
int row = view.addRow ();
|
int row = view.addRow ();
|
||||||
view.set (row, 0, userContext);
|
view.set (row, 0, userContext);
|
||||||
view.set (row, 1, definition);
|
view.set (row, 1, definition);
|
||||||
|
view.set (row, 2, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
out << optionalBlankLine ()
|
out << optionalBlankLine ()
|
||||||
|
|||||||
Reference in New Issue
Block a user