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

View file

@ -1,11 +1,12 @@
bin_PROGRAMS = task
task_SOURCES = Config.cpp Date.cpp Record.cpp T.cpp T2.cpp TDB.cpp TDB2.cpp \
Att.cpp Filter.cpp Sequence.cpp Table.cpp Grid.cpp Timer.cpp \
Duration.cpp StringTable.cpp Location.cpp Subst.cpp Keymap.cpp \
Nibbler.cpp Context.cpp Cmd.cpp color.cpp parse.cpp task.cpp \
edit.cpp command.cpp report.cpp util.cpp text.cpp rules.cpp \
import.cpp interactive.cpp recur.cpp \
Config.h Date.h Record.h T.h TDB.h Att.h Filter.h Sequence.h \
Table.h Grid.h Timer.h Duration.h StringTable.h Location.h \
Subst.h Keymap.h Nibbler.h Context.h Cmd.h color.h task.h
task_SOURCES = Att.cpp Cmd.cpp Config.cpp Context.cpp Date.cpp Duration.cpp \
Filter.cpp Grid.cpp Keymap.cpp Location.cpp Nibbler.cpp \
Record.cpp Sequence.cpp StringTable.cpp Subst.cpp T2.cpp \
TDB2.cpp Table.cpp Timer.cpp color.cpp command.cpp edit.cpp \
import.cpp interactive.cpp parse.cpp recur.cpp report.cpp \
rules.cpp task.cpp text.cpp utf8.cpp util.cpp \
Att.h Cmd.h Config.h Context.h Date.h Duration.h Filter.h \
Grid.h Keymap.h Location.h Nibbler.h Record.h Sequence.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::stringstream out;
/*
// Determine window size, and set table accordingly.
int width = context.config.get ("defaultwidth", (int) 80);
#ifdef HAVE_LIBNCURSES
@ -301,8 +301,8 @@ std::string handleVersion ()
link.setColumnJustification (0, Table::left);
link.addCell (link.addRow (), 0,
"See http://taskwarrior.org for the latest releases, online documentation "
"and lively discussion. New releases containing fixes and enhancements are "
"made frequently.");
"and lively discussion. New releases containing fixes and enhancements "
"are made frequently.");
// Create a table for output.
Table table;
@ -356,7 +356,7 @@ std::string handleVersion ()
// Complain about configuration variables that are not recognized.
// 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 =
" blanklines color color.active color.due color.overdue color.pri.H "
"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
// dynamic.
if (i->find ("color.keyword.") == std::string::npos &&
i->find ("color.project.") == std::string::npos &&
i->find ("color.tag.") == std::string::npos &&
i->find ("report.") == std::string::npos)
if (i->substr (0, 14) != "color.keyword." &&
i->substr (0, 14) != "color.project." &&
i->substr (0, 10) != "color.tag." &&
i->substr (0, 7) != "report.")
{
unrecognized.push_back (*i);
}
@ -423,7 +423,7 @@ std::string handleVersion ()
" that doesn't exist, or is unreadable."
<< std::endl;
}
*/
return out.str ();
}

View file

@ -83,8 +83,8 @@ int Context::interactive ()
bkgdset (COLOR_PAIR (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 + 1, width / 2 - 14, " Coming in version 2.0.0 ");
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 - 16, " Coming in version 2.0.0 ");
std::string footer = "Press 'q' to quit.";
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
// 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;
// Look at all tasks and find any recurring ones.
@ -134,6 +135,7 @@ void handleRecurrence (TDB& tdb, std::vector <T>& tasks)
}
tasks = modified;
*/
}
////////////////////////////////////////////////////////////////////////////////

View file

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