mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-02 05:30:23 +02:00
Code Cleanup
- The "next" command had two control paths. One was via custom reports (correct) and the other was a residual handler (obsolete), which is now removed. This also simplifies a handleCustomReport/runCustomReport issue.
This commit is contained in:
parent
307027a1d9
commit
254b418708
3 changed files with 1 additions and 71 deletions
|
@ -251,8 +251,7 @@ int Context::dispatch (std::string &out)
|
||||||
else if (cmd.command == "" &&
|
else if (cmd.command == "" &&
|
||||||
sequence.size ()) { rc = handleModify (out); }
|
sequence.size ()) { rc = handleModify (out); }
|
||||||
|
|
||||||
// Command that display IDs and therefore need TDB::gc first.
|
// Commands that display IDs and therefore need TDB::gc first.
|
||||||
else if (cmd.command == "next") { if (!inShadow) tdb.gc (); rc = handleReportNext (out); }
|
|
||||||
else if (cmd.validCustom (cmd.command)) { if (!inShadow) tdb.gc (); rc = handleCustomReport (cmd.command, out); }
|
else if (cmd.validCustom (cmd.command)) { if (!inShadow) tdb.gc (); rc = handleCustomReport (cmd.command, out); }
|
||||||
|
|
||||||
// If the command is not recognized, display usage.
|
// If the command is not recognized, display usage.
|
||||||
|
|
|
@ -99,7 +99,6 @@ int shortUsage (std::string &);
|
||||||
int longUsage (std::string &);
|
int longUsage (std::string &);
|
||||||
int handleInfo (std::string &);
|
int handleInfo (std::string &);
|
||||||
int handleReportSummary (std::string &);
|
int handleReportSummary (std::string &);
|
||||||
int handleReportNext (std::string &);
|
|
||||||
int handleReportHistoryMonthly (std::string &);
|
int handleReportHistoryMonthly (std::string &);
|
||||||
int handleReportHistoryAnnual (std::string &);
|
int handleReportHistoryAnnual (std::string &);
|
||||||
int handleReportGHistoryMonthly (std::string &);
|
int handleReportGHistoryMonthly (std::string &);
|
||||||
|
|
|
@ -742,74 +742,6 @@ int handleReportSummary (std::string &outs)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// A summary of the most important pending tasks.
|
|
||||||
//
|
|
||||||
// For every project, pull important tasks to present as an 'immediate' task
|
|
||||||
// list. This hides the overwhelming quantity of other tasks.
|
|
||||||
//
|
|
||||||
// Present at most three tasks for every project. Select the tasks using
|
|
||||||
// these criteria:
|
|
||||||
// - due:< 1wk, pri:*
|
|
||||||
// - due:*, pri:H
|
|
||||||
// - pri:H
|
|
||||||
// - due:*, pri:M
|
|
||||||
// - pri:M
|
|
||||||
// - due:*, pri:L
|
|
||||||
// - pri:L
|
|
||||||
// - due:*, pri:* <-- everything else
|
|
||||||
//
|
|
||||||
// Make the "three" tasks a configurable number
|
|
||||||
//
|
|
||||||
int handleReportNext (std::string &outs)
|
|
||||||
{
|
|
||||||
// Load report configuration.
|
|
||||||
std::string columnList = context.config.get ("report.next.columns");
|
|
||||||
std::string labelList = context.config.get ("report.next.labels");
|
|
||||||
std::string sortList = context.config.get ("report.next.sort");
|
|
||||||
std::string filterList = context.config.get ("report.next.filter");
|
|
||||||
|
|
||||||
std::vector <std::string> filterArgs;
|
|
||||||
split (filterArgs, filterList, ' ');
|
|
||||||
{
|
|
||||||
Cmd cmd ("next");
|
|
||||||
Task task;
|
|
||||||
Sequence sequence;
|
|
||||||
Subst subst;
|
|
||||||
Filter filter;
|
|
||||||
context.parse (filterArgs, cmd, task, sequence, subst, filter);
|
|
||||||
|
|
||||||
context.sequence.combine (sequence);
|
|
||||||
|
|
||||||
// Allow limit to be overridden by the command line.
|
|
||||||
if (!context.task.has ("limit") && task.has ("limit"))
|
|
||||||
context.task.set ("limit", task.get ("limit"));
|
|
||||||
|
|
||||||
foreach (att, filter)
|
|
||||||
context.filter.push_back (*att);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get all the tasks.
|
|
||||||
std::vector <Task> tasks;
|
|
||||||
context.tdb.lock (context.config.getBoolean ("locking"));
|
|
||||||
handleRecurrence ();
|
|
||||||
context.tdb.load (tasks, context.filter);
|
|
||||||
context.tdb.commit ();
|
|
||||||
context.tdb.unlock ();
|
|
||||||
|
|
||||||
// Restrict to matching subset.
|
|
||||||
gatherNextTasks (tasks);
|
|
||||||
|
|
||||||
return runCustomReport (
|
|
||||||
"next",
|
|
||||||
columnList,
|
|
||||||
labelList,
|
|
||||||
sortList,
|
|
||||||
filterList,
|
|
||||||
tasks,
|
|
||||||
outs);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Year Month Added Completed Deleted
|
// Year Month Added Completed Deleted
|
||||||
// 2006 November 87 63 14
|
// 2006 November 87 63 14
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue