mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
ColProject: Special ::modify handling for 'project'
This commit is contained in:
parent
7ae5e4657d
commit
575433542f
2 changed files with 36 additions and 0 deletions
|
@ -27,12 +27,18 @@
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
#include <ColProject.h>
|
#include <ColProject.h>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
|
#include <Eval.h>
|
||||||
|
#include <Variant.h>
|
||||||
|
#include <Lexer.h>
|
||||||
|
#include <Filter.h>
|
||||||
|
#include <Dates.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <utf8.h>
|
#include <utf8.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
#include <i18n.h>
|
#include <i18n.h>
|
||||||
|
|
||||||
extern Context context;
|
extern Context context;
|
||||||
|
extern Task& contextTask;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
ColumnProject::ColumnProject ()
|
ColumnProject::ColumnProject ()
|
||||||
|
@ -107,3 +113,32 @@ void ColumnProject::render (
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void ColumnProject::modify (Task& task, const std::string& value)
|
||||||
|
{
|
||||||
|
std::string label = " [1;37;43mMODIFICATION[0m ";
|
||||||
|
|
||||||
|
// Only if it's a DOM ref, eval it first.
|
||||||
|
Lexer lexer (value);
|
||||||
|
std::string domRef;
|
||||||
|
Lexer::Type type;
|
||||||
|
if (lexer.token (domRef, type) &&
|
||||||
|
type == Lexer::Type::dom)
|
||||||
|
{
|
||||||
|
Eval e;
|
||||||
|
e.addSource (domSource);
|
||||||
|
e.addSource (namedDates);
|
||||||
|
contextTask = task;
|
||||||
|
|
||||||
|
Variant v;
|
||||||
|
e.evaluateInfixExpression (value, v);
|
||||||
|
task.set (_name, (std::string) v);
|
||||||
|
context.debug (label + _name + " <-- '" + (std::string) v + "' <-- '" + value + "'");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
task.set (_name, value);
|
||||||
|
context.debug (label + _name + " <-- '" + value + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
ColumnProject ();
|
ColumnProject ();
|
||||||
void measure (Task&, unsigned int&, unsigned int&);
|
void measure (Task&, unsigned int&, unsigned int&);
|
||||||
void render (std::vector <std::string>&, Task&, int, Color&);
|
void render (std::vector <std::string>&, Task&, int, Color&);
|
||||||
|
void modify (Task&, const std::string&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _hyphenate;
|
bool _hyphenate;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue