mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Merge branch 'recurrence' into 2.6.0
This commit is contained in:
commit
4e7576cb79
65 changed files with 652 additions and 484 deletions
|
@ -32,7 +32,6 @@
|
|||
#include <Context.h>
|
||||
#include <Table.h>
|
||||
#include <Command.h>
|
||||
#include <ColString.h>
|
||||
#include <util.h>
|
||||
#include <i18n.h>
|
||||
|
||||
|
|
|
@ -90,8 +90,7 @@ int CmdDenotate::execute (std::string&)
|
|||
{
|
||||
Task before (task);
|
||||
|
||||
std::map <std::string, std::string> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
auto annotations = task.getAnnotations ();
|
||||
|
||||
if (annotations.size () == 0)
|
||||
throw std::string (STRING_CMD_DENO_NONE);
|
||||
|
|
|
@ -456,10 +456,7 @@ int CmdDiagnostics::execute (std::string& output)
|
|||
for (auto& task : all)
|
||||
{
|
||||
// Check dependencies
|
||||
std::vector <std::string> dependencies;
|
||||
task.getDependencies(dependencies);
|
||||
|
||||
for (auto& uuid : dependencies)
|
||||
for (auto& uuid : task.getDependencyUUIDs ())
|
||||
{
|
||||
if (! context.tdb2.has (uuid))
|
||||
{
|
||||
|
|
|
@ -224,14 +224,10 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
|
|||
<< "# iMask: " << task.get ("imask") << '\n'
|
||||
<< " Project: " << task.get ("project") << '\n';
|
||||
|
||||
std::vector <std::string> tags;
|
||||
task.getTags (tags);
|
||||
auto allTags = join (" ", tags);
|
||||
|
||||
if (verbose)
|
||||
before << "# " << STRING_EDIT_TAG_SEP << '\n';
|
||||
|
||||
before << " Tags: " << allTags << '\n'
|
||||
before << " Tags: " << join (" ", task.getTags ()) << '\n'
|
||||
<< " Description: " << task.get ("description") << '\n'
|
||||
<< " Created: " << formatDate (task, "entry", dateformat) << '\n'
|
||||
<< " Started: " << formatDate (task, "start", dateformat) << '\n'
|
||||
|
@ -249,9 +245,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
|
|||
<< "# " << STRING_EDIT_HEADER_14 << '\n'
|
||||
<< "# " << STRING_EDIT_HEADER_15 << '\n';
|
||||
|
||||
std::map <std::string, std::string> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
for (auto& anno : annotations)
|
||||
for (auto& anno : task.getAnnotations ())
|
||||
{
|
||||
Datetime dt (strtol (anno.first.substr (11).c_str (), NULL, 10));
|
||||
before << " Annotation: " << dt.toString (dateformat)
|
||||
|
@ -262,8 +256,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
|
|||
before << " Annotation: " << now.toString (dateformat) << " -- \n";
|
||||
|
||||
// Add dependencies here.
|
||||
std::vector <std::string> dependencies;
|
||||
task.getDependencies (dependencies);
|
||||
auto dependencies = task.getDependencyUUIDs ();
|
||||
std::stringstream allDeps;
|
||||
for (unsigned int i = 0; i < dependencies.size (); ++i)
|
||||
{
|
||||
|
@ -312,9 +305,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
|
|||
}
|
||||
|
||||
// UDA orphans
|
||||
std::vector <std::string> orphans;
|
||||
task.getUDAOrphans (orphans);
|
||||
|
||||
auto orphans = task.getUDAOrphanUUIDs ();
|
||||
if (orphans.size ())
|
||||
{
|
||||
before << "# " << STRING_EDIT_UDA_ORPHAN_SEP << '\n';
|
||||
|
@ -355,9 +346,8 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
|
|||
|
||||
// tags
|
||||
value = findValue (after, "\n Tags:");
|
||||
auto tags = split (value, ' ');
|
||||
task.remove ("tags");
|
||||
task.addTags (tags);
|
||||
task.addTags (split (value, ' '));
|
||||
|
||||
// description.
|
||||
value = findMultilineValue (after, "\n Description:", "\n Created:");
|
||||
|
|
|
@ -134,9 +134,7 @@ int CmdInfo::execute (std::string& output)
|
|||
std::string description = task.get ("description");
|
||||
int indent = context.config.getInteger ("indent.annotation");
|
||||
|
||||
std::map <std::string, std::string> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
for (auto& anno : annotations)
|
||||
for (auto& anno : task.getAnnotations ())
|
||||
description += '\n'
|
||||
+ std::string (indent, ' ')
|
||||
+ Datetime (anno.first.substr (11)).toString (dateformatanno)
|
||||
|
@ -162,8 +160,7 @@ int CmdInfo::execute (std::string& output)
|
|||
|
||||
// dependencies: blocked
|
||||
{
|
||||
std::vector <Task> blocked;
|
||||
dependencyGetBlocking (task, blocked);
|
||||
auto blocked = dependencyGetBlocking (task);
|
||||
if (blocked.size ())
|
||||
{
|
||||
std::stringstream message;
|
||||
|
@ -178,8 +175,7 @@ int CmdInfo::execute (std::string& output)
|
|||
|
||||
// dependencies: blocking
|
||||
{
|
||||
std::vector <Task> blocking;
|
||||
dependencyGetBlocked (task, blocking);
|
||||
auto blocking = dependencyGetBlocked (task);
|
||||
if (blocking.size ())
|
||||
{
|
||||
std::stringstream message;
|
||||
|
@ -201,6 +197,7 @@ int CmdInfo::execute (std::string& output)
|
|||
}
|
||||
|
||||
// parent
|
||||
// 2017-01-07: Deprecated in 2.6.0
|
||||
if (task.has ("parent"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
|
@ -209,6 +206,7 @@ int CmdInfo::execute (std::string& output)
|
|||
}
|
||||
|
||||
// mask
|
||||
// 2017-01-07: Deprecated in 2.6.0
|
||||
if (task.has ("mask"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
|
@ -217,6 +215,7 @@ int CmdInfo::execute (std::string& output)
|
|||
}
|
||||
|
||||
// imask
|
||||
// 2017-01-07: Deprecated in 2.6.0
|
||||
if (task.has ("imask"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
|
@ -224,6 +223,30 @@ int CmdInfo::execute (std::string& output)
|
|||
view.set (row, 1, task.get ("imask"));
|
||||
}
|
||||
|
||||
// template
|
||||
if (task.has ("template"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_TEMPLATE);
|
||||
view.set (row, 1, task.get ("template"));
|
||||
}
|
||||
|
||||
// last
|
||||
if (task.has ("last"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_LAST);
|
||||
view.set (row, 1, task.get ("last"));
|
||||
}
|
||||
|
||||
// rtype
|
||||
if (task.has ("rtype"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_RTYPE);
|
||||
view.set (row, 1, task.get ("rtype"));
|
||||
}
|
||||
|
||||
// entry
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_ENTERED);
|
||||
|
@ -300,8 +323,7 @@ int CmdInfo::execute (std::string& output)
|
|||
}
|
||||
|
||||
// tags ...
|
||||
std::vector <std::string> tags;
|
||||
task.getTags (tags);
|
||||
auto tags = task.getTags ();
|
||||
if (tags.size ())
|
||||
{
|
||||
auto allTags = join (" ", tags);
|
||||
|
@ -320,19 +342,21 @@ int CmdInfo::execute (std::string& output)
|
|||
if (task.hasTag ("ANNOTATED")) virtualTags += "ANNOTATED ";
|
||||
if (task.hasTag ("BLOCKED")) virtualTags += "BLOCKED ";
|
||||
if (task.hasTag ("BLOCKING")) virtualTags += "BLOCKING ";
|
||||
if (task.hasTag ("CHILD")) virtualTags += "CHILD ";
|
||||
if (task.hasTag ("CHILD")) virtualTags += "CHILD "; // 2017-01-07: Deprecated in 2.6.0
|
||||
if (task.hasTag ("COMPLETED")) virtualTags += "COMPLETED ";
|
||||
if (task.hasTag ("DELETED")) virtualTags += "DELETED ";
|
||||
if (task.hasTag ("DUE")) virtualTags += "DUE ";
|
||||
if (task.hasTag ("DUETODAY")) virtualTags += "DUETODAY ";
|
||||
if (task.hasTag ("INSTANCE")) virtualTags += "INSTANCE ";
|
||||
if (task.hasTag ("MONTH")) virtualTags += "MONTH ";
|
||||
if (task.hasTag ("ORPHAN")) virtualTags += "ORPHAN ";
|
||||
if (task.hasTag ("OVERDUE")) virtualTags += "OVERDUE ";
|
||||
if (task.hasTag ("PARENT")) virtualTags += "PARENT ";
|
||||
if (task.hasTag ("PARENT")) virtualTags += "PARENT "; // 2017-01-07: Deprecated in 2.6.0
|
||||
if (task.hasTag ("PENDING")) virtualTags += "PENDING ";
|
||||
if (task.hasTag ("READY")) virtualTags += "READY ";
|
||||
if (task.hasTag ("SCHEDULED")) virtualTags += "SCHEDULED ";
|
||||
if (task.hasTag ("TAGGED")) virtualTags += "TAGGED ";
|
||||
if (task.hasTag ("TEMPLATE")) virtualTags += "TEMPLATE ";
|
||||
if (task.hasTag ("TODAY")) virtualTags += "TODAY ";
|
||||
if (task.hasTag ("TOMORROW")) virtualTags += "TOMORROW ";
|
||||
if (task.hasTag ("UDA")) virtualTags += "UDA ";
|
||||
|
|
|
@ -140,13 +140,9 @@ int CmdStats::execute (std::string& output)
|
|||
daysPending += (now.toEpoch () - entry) / 86400.0;
|
||||
|
||||
descLength += task.get ("description").length ();
|
||||
annotationsT += task.getAnnotations ().size ();
|
||||
|
||||
std::map <std::string, std::string> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
annotationsT += annotations.size ();
|
||||
|
||||
std::vector <std::string> tags;
|
||||
task.getTags (tags);
|
||||
auto tags = task.getTags ();
|
||||
if (tags.size ())
|
||||
++taggedT;
|
||||
|
||||
|
|
|
@ -79,10 +79,7 @@ int CmdTags::execute (std::string& output)
|
|||
std::map <std::string, int> unique;
|
||||
for (auto& task : filtered)
|
||||
{
|
||||
std::vector <std::string> tags;
|
||||
task.getTags (tags);
|
||||
|
||||
for (auto& tag : tags)
|
||||
for (auto& tag : task.getTags ())
|
||||
if (unique.find (tag) != unique.end ())
|
||||
unique[tag]++;
|
||||
else
|
||||
|
@ -182,13 +179,8 @@ int CmdCompletionTags::execute (std::string& output)
|
|||
// names as keys.
|
||||
std::map <std::string, int> unique;
|
||||
for (auto& task : filtered)
|
||||
{
|
||||
std::vector <std::string> tags;
|
||||
task.getTags (tags);
|
||||
|
||||
for (auto& tag : tags)
|
||||
for (auto& tag : task.getTags ())
|
||||
unique[tag] = 0;
|
||||
}
|
||||
|
||||
// Add built-in tags to map.
|
||||
unique["nocolor"] = 0;
|
||||
|
@ -199,19 +191,21 @@ int CmdCompletionTags::execute (std::string& output)
|
|||
unique["ANNOTATED"] = 0;
|
||||
unique["BLOCKED"] = 0;
|
||||
unique["BLOCKING"] = 0;
|
||||
unique["CHILD"] = 0;
|
||||
unique["CHILD"] = 0; // 2017-01-07: Deprecated in 2.6.0
|
||||
unique["COMPLETED"] = 0;
|
||||
unique["DELETED"] = 0;
|
||||
unique["DUE"] = 0;
|
||||
unique["DUETODAY"] = 0;
|
||||
unique["INSTANCE"] = 0;
|
||||
unique["MONTH"] = 0;
|
||||
unique["ORPHAN"] = 0;
|
||||
unique["OVERDUE"] = 0;
|
||||
unique["PARENT"] = 0;
|
||||
unique["PARENT"] = 0; // 2017-01-07: Deprecated in 2.6.0
|
||||
unique["PENDING"] = 0;
|
||||
unique["READY"] = 0;
|
||||
unique["SCHEDULED"] = 0;
|
||||
unique["TAGGED"] = 0;
|
||||
unique["TEMPLATE"] = 0;
|
||||
unique["TODAY"] = 0;
|
||||
unique["TOMORROW"] = 0;
|
||||
unique["UDA"] = 0;
|
||||
|
|
|
@ -142,9 +142,7 @@ int CmdTimesheet::execute (std::string& output)
|
|||
std::string description = task.get ("description");
|
||||
int indent = context.config.getInteger ("indent.annotation");
|
||||
|
||||
std::map <std::string, std::string> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
for (auto& ann : annotations)
|
||||
for (auto& ann : task.getAnnotations ())
|
||||
description += '\n'
|
||||
+ std::string (indent, ' ')
|
||||
+ Datetime (ann.first.substr (11)).toString (context.config.get ("dateformat"))
|
||||
|
@ -198,9 +196,7 @@ int CmdTimesheet::execute (std::string& output)
|
|||
std::string description = task.get ("description");
|
||||
int indent = context.config.getInteger ("indent.annotation");
|
||||
|
||||
std::map <std::string, std::string> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
for (auto& ann : annotations)
|
||||
for (auto& ann : task.getAnnotations ())
|
||||
description += '\n'
|
||||
+ std::string (indent, ' ')
|
||||
+ Datetime (ann.first.substr (11)).toString (context.config.get ("dateformat"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue