mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 07:43:08 +02:00
Silver Bullet - Complete
- Entry works - Start works - End works
This commit is contained in:
parent
f97955ded8
commit
612b872ed4
1 changed files with 36 additions and 23 deletions
59
src/edit.cpp
59
src/edit.cpp
|
@ -238,13 +238,12 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
||||||
}
|
}
|
||||||
|
|
||||||
// entry
|
// entry
|
||||||
/*
|
|
||||||
value = findDate (conf, after, "Created:");
|
value = findDate (conf, after, "Created:");
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
Date original (::atoi (task.getAttribute ("entry").c_str ()));
|
|
||||||
Date edited (::atoi (value.c_str ()));
|
Date edited (::atoi (value.c_str ()));
|
||||||
|
|
||||||
|
Date original (::atoi (task.getAttribute ("entry").c_str ()));
|
||||||
if (!original.sameDay (edited))
|
if (!original.sameDay (edited))
|
||||||
{
|
{
|
||||||
std::cout << "Creation date modified." << std::endl;
|
std::cout << "Creation date modified." << std::endl;
|
||||||
|
@ -252,18 +251,24 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cout << "Cannot remove creation date." << std::endl;
|
throw std::string ("Cannot remove creation date");
|
||||||
*/
|
|
||||||
|
|
||||||
// start
|
// start
|
||||||
/*
|
value = findDate (conf, after, "Started:");
|
||||||
value = findDate (conf, after, "Start:");
|
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
Date original (::atoi (task.getAttribute ("start").c_str ()));
|
|
||||||
Date edited (::atoi (value.c_str ()));
|
Date edited (::atoi (value.c_str ()));
|
||||||
|
|
||||||
if (!original.sameDay (edited))
|
if (task.getAttribute ("start") != "")
|
||||||
|
{
|
||||||
|
Date original (::atoi (task.getAttribute ("start").c_str ()));
|
||||||
|
if (!original.sameDay (edited))
|
||||||
|
{
|
||||||
|
std::cout << "Start date modified." << std::endl;
|
||||||
|
task.setAttribute ("start", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Start date modified." << std::endl;
|
std::cout << "Start date modified." << std::endl;
|
||||||
task.setAttribute ("start", value);
|
task.setAttribute ("start", value);
|
||||||
|
@ -271,36 +276,40 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Date original (::atoi (task.getAttribute ("start").c_str ()));
|
if (task.getAttribute ("start") != "")
|
||||||
Date edited (::atoi (value.c_str ()));
|
|
||||||
|
|
||||||
if (!original.sameDay (edited))
|
|
||||||
{
|
{
|
||||||
|
std::cout << "Start date removed." << std::endl;
|
||||||
|
task.removeAttribute ("start");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Cannot remove start date." << std::endl;
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
// end
|
// end
|
||||||
/*
|
|
||||||
value = findDate (conf, after, "Ended:");
|
value = findDate (conf, after, "Ended:");
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
Date original (::atoi (task.getAttribute ("end").c_str ()));
|
|
||||||
Date edited (::atoi (value.c_str ()));
|
Date edited (::atoi (value.c_str ()));
|
||||||
|
|
||||||
if (!original.sameDay (edited))
|
if (task.getAttribute ("end") != "")
|
||||||
{
|
{
|
||||||
std::cout << "Done date modified." << std::endl;
|
Date original (::atoi (task.getAttribute ("end").c_str ()));
|
||||||
task.setAttribute ("end", value);
|
if (!original.sameDay (edited))
|
||||||
|
{
|
||||||
|
std::cout << "Done date modified." << std::endl;
|
||||||
|
task.setAttribute ("end", value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if (task.getStatus () != T::deleted)
|
||||||
|
throw std::string ("Cannot set a done date on a pending task.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Done date removed." << std::endl;
|
if (task.getAttribute ("end") != "")
|
||||||
task.removeAttribute ("end");
|
{
|
||||||
|
std::cout << "Done date removed." << std::endl;
|
||||||
|
task.setStatus (T::pending);
|
||||||
|
task.removeAttribute ("end");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// due
|
// due
|
||||||
value = findDate (conf, after, "Due:");
|
value = findDate (conf, after, "Due:");
|
||||||
|
@ -393,7 +402,11 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Recurrence removed." << std::endl;
|
std::cout << "Recurrence removed." << std::endl;
|
||||||
|
task.setStatus (T::pending);
|
||||||
task.removeAttribute ("recur");
|
task.removeAttribute ("recur");
|
||||||
|
task.removeAttribute ("until");
|
||||||
|
task.removeAttribute ("mask");
|
||||||
|
task.removeAttribute ("imask");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue