diff --git a/src/Context.cpp b/src/Context.cpp index 472f7993a..957f6d325 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -164,6 +164,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 (command == "info") { out = handleInfo (tdb, task); } else if (command == "stats") { out = handleReportStats (tdb, task); } @@ -172,7 +173,6 @@ void Context::dispatch () 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 == "colors") { out = handleColor ( ); } else if (command == "version") { out = handleVersion ( ); } else if (command == "help") { out = longUsage ( ); } diff --git a/src/command.cpp b/src/command.cpp index 5f03d0e0c..9f3da72fd 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -50,7 +50,7 @@ extern Context context; std::string handleAdd (TDB& tdb, T& task) { std::stringstream out; - +/* char entryTime[16]; sprintf (entryTime, "%u", (unsigned int) time (NULL)); task.setAttribute ("entry", entryTime); @@ -87,7 +87,7 @@ std::string handleAdd (TDB& tdb, T& task) if (!tdb.addT (task)) throw std::string ("Could not create new task."); - +*/ return out.str (); } @@ -196,7 +196,7 @@ std::string handleTags () std::string handleUndelete (TDB& tdb, T& task) { std::stringstream out; - +/* std::vector all; tdb.allPendingT (all); filterSequence (all, task); @@ -224,7 +224,7 @@ std::string handleUndelete (TDB& tdb, T& task) << "Please note that tasks can only be reliably undeleted if the undelete " << "command is run immediately after the errant delete command." << std::endl; - +*/ return out.str (); } @@ -234,7 +234,7 @@ std::string handleUndelete (TDB& tdb, T& task) std::string handleUndo (TDB& tdb, T& task) { std::stringstream out; - +/* std::vector all; tdb.allPendingT (all); filterSequence (all, task); @@ -262,7 +262,7 @@ std::string handleUndo (TDB& tdb, T& task) << "Please note that tasks can only be reliably undone if the undo " << "command is run immediately after the errant done command." << std::endl; - +*/ return out.str (); } @@ -270,7 +270,7 @@ std::string handleUndo (TDB& tdb, T& task) std::string handleVersion () { std::stringstream out; - +/* // Determine window size, and set table accordingly. int width = context.config.get ("defaultwidth", (int) 80); #ifdef HAVE_LIBNCURSES @@ -423,7 +423,7 @@ std::string handleVersion () " that doesn't exist, or is unreadable." << std::endl; } - +*/ return out.str (); } @@ -431,7 +431,7 @@ std::string handleVersion () std::string handleDelete (TDB& tdb, T& task) { std::stringstream out; - +/* std::vector all; tdb.allPendingT (all); filterSequence (all, task); @@ -514,7 +514,7 @@ std::string handleDelete (TDB& tdb, T& task) else out << "Task not deleted." << std::endl; } - +*/ return out.str (); } @@ -522,7 +522,7 @@ std::string handleDelete (TDB& tdb, T& task) std::string handleStart (TDB& tdb, T& task) { std::stringstream out; - +/* std::vector all; tdb.pendingT (all); filterSequence (all, task); @@ -551,7 +551,7 @@ std::string handleStart (TDB& tdb, T& task) out << "Task " << t->getId () << " '" << t->getDescription () << "' already started." << std::endl; } } - +*/ return out.str (); } @@ -559,7 +559,7 @@ std::string handleStart (TDB& tdb, T& task) std::string handleStop (TDB& tdb, T& task) { std::stringstream out; - +/* std::vector all; tdb.pendingT (all); filterSequence (all, task); @@ -579,15 +579,18 @@ std::string handleStop (TDB& tdb, T& task) out << "Task " << t->getId () << " '" << t->getDescription () << "' not started." << std::endl; } } - +*/ return out.str (); } //////////////////////////////////////////////////////////////////////////////// std::string handleDone (TDB& tdb, T& task) { +/* int count = 0; +*/ std::stringstream out; +/* std::vector all; tdb.allPendingT (all); @@ -643,7 +646,7 @@ std::string handleDone (TDB& tdb, T& task) << (count == 1 ? "" : "s") << " as done" << std::endl; - +*/ return out.str (); } @@ -651,7 +654,7 @@ std::string handleDone (TDB& tdb, T& task) std::string handleExport (TDB& tdb, T& task) { std::stringstream output; - +/* // Use the description as a file name, then clobber the description so the // file name isn't used for filtering. std::string file = trim (task.getDescription ()); @@ -700,15 +703,18 @@ std::string handleExport (TDB& tdb, T& task) } else throw std::string ("You must specify a file to write to."); - +*/ return output.str (); } //////////////////////////////////////////////////////////////////////////////// std::string handleModify (TDB& tdb, T& task) { +/* int count = 0; +*/ std::stringstream out; +/* std::vector all; tdb.allPendingT (all); @@ -754,15 +760,18 @@ std::string handleModify (TDB& tdb, T& task) if (context.config.get ("echo.command", true)) out << "Modified " << count << " task" << (count == 1 ? "" : "s") << std::endl; - +*/ return out.str (); } //////////////////////////////////////////////////////////////////////////////// std::string handleAppend (TDB& tdb, T& task) { +/* int count = 0; +*/ std::stringstream out; +/* std::vector all; tdb.allPendingT (all); @@ -804,15 +813,18 @@ std::string handleAppend (TDB& tdb, T& task) if (context.config.get ("echo.command", true)) out << "Appended " << count << " task" << (count == 1 ? "" : "s") << std::endl; - +*/ return out.str (); } //////////////////////////////////////////////////////////////////////////////// std::string handleDuplicate (TDB& tdb, T& task) { +/* int count = 0; +*/ std::stringstream out; +/* std::vector all; tdb.allPendingT (all); @@ -859,7 +871,7 @@ std::string handleDuplicate (TDB& tdb, T& task) if (context.config.get ("echo.command", true)) out << "Duplicated " << count << " task" << (count == 1 ? "" : "s") << std::endl; - +*/ return out.str (); } @@ -867,7 +879,6 @@ std::string handleDuplicate (TDB& tdb, T& task) std::string handleColor () { std::stringstream out; - if (context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) { out << optionalBlankLine () << "Foreground" << std::endl @@ -917,35 +928,37 @@ std::string handleColor () << Text::colorize (Text::bold_underline_white, Text::nocolor, "bold_underline_white") << std::endl << std::endl << "Background" << std::endl - << " " << Text::colorize (Text::nocolor, Text::on_black, "on_black") << " " - << Text::colorize (Text::nocolor, Text::on_bright_black, "on_bright_black") << std::endl + << " " << Text::colorize (Text::nocolor, Text::on_black, "on_black") << " " + << Text::colorize (Text::nocolor, Text::on_bright_black, "on_bright_black") << std::endl - << " " << Text::colorize (Text::nocolor, Text::on_red, "on_red") << " " - << Text::colorize (Text::nocolor, Text::on_bright_red, "on_bright_red") << std::endl + << " " << Text::colorize (Text::nocolor, Text::on_red, "on_red") << " " + << Text::colorize (Text::nocolor, Text::on_bright_red, "on_bright_red") << std::endl - << " " << Text::colorize (Text::nocolor, Text::on_green, "on_green") << " " - << Text::colorize (Text::nocolor, Text::on_bright_green, "on_bright_green") << std::endl + << " " << Text::colorize (Text::nocolor, Text::on_green, "on_green") << " " + << Text::colorize (Text::nocolor, Text::on_bright_green, "on_bright_green") << std::endl - << " " << Text::colorize (Text::nocolor, Text::on_yellow, "on_yellow") << " " - << Text::colorize (Text::nocolor, Text::on_bright_yellow, "on_bright_yellow") << std::endl + << " " << Text::colorize (Text::nocolor, Text::on_yellow, "on_yellow") << " " + << Text::colorize (Text::nocolor, Text::on_bright_yellow, "on_bright_yellow") << std::endl - << " " << Text::colorize (Text::nocolor, Text::on_blue, "on_blue") << " " - << Text::colorize (Text::nocolor, Text::on_bright_blue, "on_bright_blue") << std::endl + << " " << Text::colorize (Text::nocolor, Text::on_blue, "on_blue") << " " + << Text::colorize (Text::nocolor, Text::on_bright_blue, "on_bright_blue") << std::endl - << " " << Text::colorize (Text::nocolor, Text::on_magenta, "on_magenta") << " " - << Text::colorize (Text::nocolor, Text::on_bright_magenta, "on_bright_magenta") << std::endl + << " " << Text::colorize (Text::nocolor, Text::on_magenta, "on_magenta") << " " + << Text::colorize (Text::nocolor, Text::on_bright_magenta, "on_bright_magenta") << std::endl - << " " << Text::colorize (Text::nocolor, Text::on_cyan, "on_cyan") << " " - << Text::colorize (Text::nocolor, Text::on_bright_cyan, "on_bright_cyan") << std::endl + << " " << Text::colorize (Text::nocolor, Text::on_cyan, "on_cyan") << " " + << Text::colorize (Text::nocolor, Text::on_bright_cyan, "on_bright_cyan") << std::endl - << " " << Text::colorize (Text::nocolor, Text::on_white, "on_white") << " " - << Text::colorize (Text::nocolor, Text::on_bright_white, "on_bright_white") << std::endl + << " " << Text::colorize (Text::nocolor, Text::on_white, "on_white") << " " + << Text::colorize (Text::nocolor, Text::on_bright_white, "on_bright_white") << std::endl << optionalBlankLine (); } else { - out << "Color is currently turned off in your .taskrc file." << std::endl; + out << "Color is currently turned off in your .taskrc file. " + "To enable color, create the entry 'color=on'." + << std::endl; } return out.str (); @@ -954,10 +967,13 @@ std::string handleColor () //////////////////////////////////////////////////////////////////////////////// std::string handleAnnotate (TDB& tdb, T& task) { +/* if (task.getDescription () == "") throw std::string ("Cannot apply a blank annotation."); +*/ std::stringstream out; +/* std::vector all; tdb.pendingT (all); filterSequence (all, task); @@ -975,21 +991,10 @@ std::string handleAnnotate (TDB& tdb, T& task) << "'" << std::endl; } - +*/ return out.str (); } -//////////////////////////////////////////////////////////////////////////////// -T findT (int id, const std::vector & all) -{ - std::vector ::const_iterator it; - for (it = all.begin (); it != all.end (); ++it) - if (id == it->getId ()) - return *it; - - return T (); -} - //////////////////////////////////////////////////////////////////////////////// int deltaAppend (T& task, T& delta) { diff --git a/src/report.cpp b/src/report.cpp index 2e67765a1..ddeab8416 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -207,7 +207,7 @@ void filter (std::vector& all, T& task) std::string handleCompleted (TDB& tdb, T& task) { std::stringstream out; - +/* // Determine window size, and set table accordingly. int width = context.config.get ("defaultwidth", (int) 80); #ifdef HAVE_LIBNCURSES @@ -303,6 +303,7 @@ std::string handleCompleted (TDB& tdb, T& task) else out << "No matches." << std::endl; +*/ return out.str (); } @@ -312,7 +313,7 @@ std::string handleCompleted (TDB& tdb, T& task) std::string handleInfo (TDB& tdb, T& task) { std::stringstream out; - +/* // Determine window size, and set table accordingly. int width = context.config.get ("defaultwidth", (int) 80); #ifdef HAVE_LIBNCURSES @@ -544,7 +545,7 @@ std::string handleInfo (TDB& tdb, T& task) if (! tasks.size ()) out << "No matches." << std::endl; - +*/ return out.str (); } @@ -555,7 +556,7 @@ std::string handleInfo (TDB& tdb, T& task) std::string handleReportSummary (TDB& tdb, T& task) { std::stringstream out; - +/* std::vector tasks; tdb.allT (tasks); handleRecurrence (tdb, tasks); @@ -692,7 +693,7 @@ std::string handleReportSummary (TDB& tdb, T& task) << std::endl; else out << "No projects." << std::endl; - +*/ return out.str (); } @@ -718,7 +719,7 @@ std::string handleReportSummary (TDB& tdb, T& task) std::string handleReportNext (TDB& tdb, T& task) { std::stringstream out; - +/* // Load all pending. std::vector pending; tdb.allPendingT (pending); @@ -875,7 +876,7 @@ std::string handleReportNext (TDB& tdb, T& task) else out << "No matches." << std::endl; - +*/ return out.str (); } @@ -904,7 +905,7 @@ time_t monthlyEpoch (const std::string& date) std::string handleReportHistory (TDB& tdb, T& task) { std::stringstream out; - +/* std::map groups; std::map addedGroup; std::map completedGroup; @@ -1089,7 +1090,7 @@ std::string handleReportHistory (TDB& tdb, T& task) << std::endl; else out << "No tasks." << std::endl; - +*/ return out.str (); } @@ -1097,7 +1098,7 @@ std::string handleReportHistory (TDB& tdb, T& task) std::string handleReportGHistory (TDB& tdb, T& task) { std::stringstream out; - +/* // Determine window size, and set table accordingly. int width = context.config.get ("defaultwidth", (int) 80); #ifdef HAVE_LIBNCURSES @@ -1334,7 +1335,7 @@ std::string handleReportGHistory (TDB& tdb, T& task) } else out << "No tasks." << std::endl; - +*/ return out.str (); } @@ -1342,7 +1343,7 @@ std::string handleReportGHistory (TDB& tdb, T& task) std::string handleReportTimesheet (TDB& tdb, T& task) { std::stringstream out; - +/* // Determine window size, and set table accordingly. int width = context.config.get ("defaultwidth", (int) 80); #ifdef HAVE_LIBNCURSES @@ -1537,7 +1538,7 @@ std::string handleReportTimesheet (TDB& tdb, T& task) start -= 7 * 86400; end -= 7 * 86400; } - +*/ return out.str (); } @@ -1706,7 +1707,7 @@ std::string renderMonths ( std::string handleReportCalendar (TDB& tdb, T& task) { std::stringstream out; - +/* // Determine window size, and set table accordingly. int width = context.config.get ("defaultwidth", (int) 80); #ifdef HAVE_LIBNCURSES @@ -1824,7 +1825,7 @@ std::string handleReportCalendar (TDB& tdb, T& task) << "." << optionalBlankLine () << std::endl; - +*/ return out.str (); } @@ -1832,7 +1833,7 @@ std::string handleReportCalendar (TDB& tdb, T& task) std::string handleReportActive (TDB& tdb, T& task) { std::stringstream out; - +/* // Determine window size, and set table accordingly. int width = context.config.get ("defaultwidth", (int) 80); #ifdef HAVE_LIBNCURSES @@ -1958,7 +1959,7 @@ std::string handleReportActive (TDB& tdb, T& task) << std::endl; else out << "No active tasks." << std::endl; - +*/ return out.str (); } @@ -1966,7 +1967,7 @@ std::string handleReportActive (TDB& tdb, T& task) std::string handleReportOverdue (TDB& tdb, T& task) { std::stringstream out; - +/* // Determine window size, and set table accordingly. int width = context.config.get ("defaultwidth", (int) 80); #ifdef HAVE_LIBNCURSES @@ -2082,7 +2083,7 @@ std::string handleReportOverdue (TDB& tdb, T& task) << std::endl; else out << "No overdue tasks." << std::endl; - +*/ return out.str (); } @@ -2090,7 +2091,7 @@ std::string handleReportOverdue (TDB& tdb, T& task) std::string handleReportStats (TDB& tdb, T& task) { std::stringstream out; - +/* // Determine window size, and set table accordingly. int width = context.config.get ("defaultwidth", (int) 80); #ifdef HAVE_LIBNCURSES @@ -2284,7 +2285,7 @@ std::string handleReportStats (TDB& tdb, T& task) out << optionalBlankLine () << table.render () << optionalBlankLine (); - +*/ return out.str (); } @@ -2481,6 +2482,7 @@ std::string handleCustomReport ( T& task, const std::string& report) { +/* // Determine window size, and set table accordingly. int width = context.config.get ("defaultwidth", (int) 80); #ifdef HAVE_LIBNCURSES @@ -2890,8 +2892,9 @@ std::string handleCustomReport ( if (sequence.size () == 1) maximum = sequence[0]; } - +*/ std::stringstream out; +/* if (table.rowCount ()) out << optionalBlankLine () << table.render (maximum) @@ -2902,7 +2905,7 @@ std::string handleCustomReport ( else out << "No matches." << std::endl; - +*/ return out.str (); } diff --git a/src/task.cpp b/src/task.cpp index a723bded6..bd405b884 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -460,7 +460,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 == "colors") { out = handleColor ( ); } else if (command == "version") { out = handleVersion ( ); } else if (command == "help") { out = longUsage ( ); } diff --git a/src/task.h b/src/task.h index 51e1e39ca..e3c360a9e 100644 --- a/src/task.h +++ b/src/task.h @@ -79,7 +79,6 @@ std::string handleUndo (TDB&, T&); std::string handleColor (); std::string handleAnnotate (TDB&, T&); std::string handleDuplicate (TDB&, T&); -T findT (int, const std::vector &); int deltaAppend (T&, T&); int deltaDescription (T&, T&); int deltaTags (T&, T&);