Enhancements - version command

- Implemented version command.
- Corrected config handling in version command.
This commit is contained in:
Paul Beckingham 2009-06-09 23:58:05 -04:00
parent f3f77a4c78
commit 0449f9e0a2
6 changed files with 26 additions and 26 deletions

View file

@ -153,10 +153,8 @@ void Context::dispatch ()
} }
*/ */
/*
bool gcMod = false; // Change occurred by way of gc. bool gcMod = false; // Change occurred by way of gc.
bool cmdMod = false; // Change occurred by way of command type. bool cmdMod = false; // Change occurred by way of command type.
*/
std::string out; std::string out;
/* /*
// Read-only commands with no side effects. // Read-only commands with no side effects.
@ -165,6 +163,7 @@ void Context::dispatch ()
if (cmd.command == "projects") { out = handleProjects (); } if (cmd.command == "projects") { out = handleProjects (); }
else if (cmd.command == "tags") { out = handleTags (); } else if (cmd.command == "tags") { out = handleTags (); }
else if (cmd.command == "colors") { out = handleColor (); } else if (cmd.command == "colors") { out = handleColor (); }
else if (cmd.command == "version") { out = handleVersion (); }
/* /*
else if (command == "info") { out = handleInfo (); } else if (command == "info") { out = handleInfo (); }
else if (command == "stats") { out = handleReportStats (); } else if (command == "stats") { out = handleReportStats (); }
@ -173,7 +172,6 @@ void Context::dispatch ()
else if (command == "calendar") { out = handleReportCalendar (); } else if (command == "calendar") { out = handleReportCalendar (); }
else if (command == "summary") { out = handleReportSummary (); } else if (command == "summary") { out = handleReportSummary (); }
else if (command == "timesheet") { out = handleReportTimesheet (); } else if (command == "timesheet") { out = handleReportTimesheet (); }
else if (command == "version") { out = handleVersion (); }
else if (command == "help") { out = longUsage (); } else if (command == "help") { out = longUsage (); }
// Commands that cause updates. // Commands that cause updates.

View file

@ -1,11 +1,12 @@
bin_PROGRAMS = task bin_PROGRAMS = task
task_SOURCES = Config.cpp Date.cpp Record.cpp T.cpp T2.cpp TDB.cpp TDB2.cpp \ task_SOURCES = Att.cpp Cmd.cpp Config.cpp Context.cpp Date.cpp Duration.cpp \
Att.cpp Filter.cpp Sequence.cpp Table.cpp Grid.cpp Timer.cpp \ Filter.cpp Grid.cpp Keymap.cpp Location.cpp Nibbler.cpp \
Duration.cpp StringTable.cpp Location.cpp Subst.cpp Keymap.cpp \ Record.cpp Sequence.cpp StringTable.cpp Subst.cpp T2.cpp \
Nibbler.cpp Context.cpp Cmd.cpp color.cpp parse.cpp task.cpp \ TDB2.cpp Table.cpp Timer.cpp color.cpp command.cpp edit.cpp \
edit.cpp command.cpp report.cpp util.cpp text.cpp rules.cpp \ import.cpp interactive.cpp parse.cpp recur.cpp report.cpp \
import.cpp interactive.cpp recur.cpp \ rules.cpp task.cpp text.cpp utf8.cpp util.cpp \
Config.h Date.h Record.h T.h TDB.h Att.h Filter.h Sequence.h \ Att.h Cmd.h Config.h Context.h Date.h Duration.h Filter.h \
Table.h Grid.h Timer.h Duration.h StringTable.h Location.h \ Grid.h Keymap.h Location.h Nibbler.h Record.h Sequence.h \
Subst.h Keymap.h Nibbler.h Context.h Cmd.h color.h task.h StringTable.h Subst.h T2.h TDB2.h Table.h Timer.h color.h \
i18n.h task.h text.h utf8.h util.h \
T.cpp T.h TDB.cpp TDB.h

View file

@ -270,7 +270,7 @@ std::string handleUndo ()
std::string handleVersion () std::string handleVersion ()
{ {
std::stringstream out; std::stringstream out;
/*
// Determine window size, and set table accordingly. // Determine window size, and set table accordingly.
int width = context.config.get ("defaultwidth", (int) 80); int width = context.config.get ("defaultwidth", (int) 80);
#ifdef HAVE_LIBNCURSES #ifdef HAVE_LIBNCURSES
@ -301,8 +301,8 @@ std::string handleVersion ()
link.setColumnJustification (0, Table::left); link.setColumnJustification (0, Table::left);
link.addCell (link.addRow (), 0, link.addCell (link.addRow (), 0,
"See http://taskwarrior.org for the latest releases, online documentation " "See http://taskwarrior.org for the latest releases, online documentation "
"and lively discussion. New releases containing fixes and enhancements are " "and lively discussion. New releases containing fixes and enhancements "
"made frequently."); "are made frequently.");
// Create a table for output. // Create a table for output.
Table table; Table table;
@ -356,7 +356,7 @@ std::string handleVersion ()
// Complain about configuration variables that are not recognized. // Complain about configuration variables that are not recognized.
// These are the regular configuration variables. // These are the regular configuration variables.
// Note that there is a leading and trailing space. // Note that there is a leading and trailing space, to make searching easier.
std::string recognized = std::string recognized =
" blanklines color color.active color.due color.overdue color.pri.H " " blanklines color color.active color.due color.overdue color.pri.H "
"color.pri.L color.pri.M color.pri.none color.recurring color.tagged " "color.pri.L color.pri.M color.pri.none color.recurring color.tagged "
@ -384,10 +384,10 @@ std::string handleVersion ()
{ {
// These are special configuration variables, because their name is // These are special configuration variables, because their name is
// dynamic. // dynamic.
if (i->find ("color.keyword.") == std::string::npos && if (i->substr (0, 14) != "color.keyword." &&
i->find ("color.project.") == std::string::npos && i->substr (0, 14) != "color.project." &&
i->find ("color.tag.") == std::string::npos && i->substr (0, 10) != "color.tag." &&
i->find ("report.") == std::string::npos) i->substr (0, 7) != "report.")
{ {
unrecognized.push_back (*i); unrecognized.push_back (*i);
} }
@ -423,7 +423,7 @@ std::string handleVersion ()
" that doesn't exist, or is unreadable." " that doesn't exist, or is unreadable."
<< std::endl; << std::endl;
} }
*/
return out.str (); return out.str ();
} }

View file

@ -83,8 +83,8 @@ int Context::interactive ()
bkgdset (COLOR_PAIR (2)); bkgdset (COLOR_PAIR (2));
int line = height / 2; int line = height / 2;
mvprintw (line, width / 2 - 14, " I n t e r a c t i v e t a s k "); mvprintw (line, width / 2 - 16, " I n t e r a c t i v e t a s k ");
mvprintw (line + 1, width / 2 - 14, " Coming in version 2.0.0 "); mvprintw (line + 1, width / 2 - 16, " Coming in version 2.0.0 ");
std::string footer = "Press 'q' to quit."; std::string footer = "Press 'q' to quit.";
while ((int) footer.length () < width) while ((int) footer.length () < width)

View file

@ -56,8 +56,9 @@ extern Context context;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Scans all tasks, and for any recurring tasks, determines whether any new // Scans all tasks, and for any recurring tasks, determines whether any new
// child tasks need to be generated to fill gaps. // child tasks need to be generated to fill gaps.
void handleRecurrence (TDB& tdb, std::vector <T>& tasks) void handleRecurrence (std::vector <T2>& tasks)
{ {
/*
std::vector <T> modified; std::vector <T> modified;
// Look at all tasks and find any recurring ones. // Look at all tasks and find any recurring ones.
@ -134,6 +135,7 @@ void handleRecurrence (TDB& tdb, std::vector <T>& tasks)
} }
tasks = modified; tasks = modified;
*/
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -462,7 +462,6 @@ std::string runTaskCommand (
else if (command == "calendar") { out = handleReportCalendar (tdb, task); } else if (command == "calendar") { out = handleReportCalendar (tdb, task); }
else if (command == "summary") { out = handleReportSummary (tdb, task); } else if (command == "summary") { out = handleReportSummary (tdb, task); }
else if (command == "timesheet") { out = handleReportTimesheet (tdb, task); } else if (command == "timesheet") { out = handleReportTimesheet (tdb, task); }
else if (command == "version") { out = handleVersion ( ); }
else if (command == "help") { out = longUsage ( ); } else if (command == "help") { out = longUsage ( ); }
// Commands that cause updates. // Commands that cause updates.