Context: Do not apply context for the export command
This commit is contained in:
committed by
Paul Beckingham
parent
4eb70e68b7
commit
1465bcb918
@@ -532,10 +532,13 @@ void CLI::applyOverrides ()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Extract all the FILTER-tagged items.
|
// Extract all the FILTER-tagged items.
|
||||||
const std::string CLI::getFilter ()
|
const std::string CLI::getFilter (bool applyContext /* = true */)
|
||||||
{
|
{
|
||||||
// Handle context setting
|
// Handle context setting
|
||||||
addContextFilter ();
|
// Commands that don't want to respect current context should leverage
|
||||||
|
// the applyContext argument
|
||||||
|
if (applyContext)
|
||||||
|
addContextFilter ();
|
||||||
|
|
||||||
std::string filter = "";
|
std::string filter = "";
|
||||||
if (_args.size ())
|
if (_args.size ())
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
void addRawFilter (const std::string& arg);
|
void addRawFilter (const std::string& arg);
|
||||||
void analyze (bool parse = true, bool strict = false);
|
void analyze (bool parse = true, bool strict = false);
|
||||||
void applyOverrides ();
|
void applyOverrides ();
|
||||||
const std::string getFilter ();
|
const std::string getFilter (bool applyContext = true);
|
||||||
const std::vector <std::string> getWords ();
|
const std::vector <std::string> getWords ();
|
||||||
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
||||||
std::string getBinary () const;
|
std::string getBinary () const;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ Filter::~Filter ()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Take an input set of tasks and filter into a subset.
|
// Take an input set of tasks and filter into a subset.
|
||||||
void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output)
|
void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output, bool applyContext /* = true */)
|
||||||
{
|
{
|
||||||
context.timer_filter.start ();
|
context.timer_filter.start ();
|
||||||
_startCount = (int) input.size ();
|
_startCount = (int) input.size ();
|
||||||
@@ -75,7 +75,7 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
|
|||||||
if (context.config.getInteger ("debug.parser") >= 1)
|
if (context.config.getInteger ("debug.parser") >= 1)
|
||||||
context.debug (context.cli.dump ("Filter::subset"));
|
context.debug (context.cli.dump ("Filter::subset"));
|
||||||
|
|
||||||
std::string filterExpr = context.cli.getFilter ();
|
std::string filterExpr = context.cli.getFilter (applyContext);
|
||||||
if (filterExpr.length ())
|
if (filterExpr.length ())
|
||||||
{
|
{
|
||||||
Eval eval;
|
Eval eval;
|
||||||
@@ -111,7 +111,7 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Take the set of all tasks and filter into a subset.
|
// Take the set of all tasks and filter into a subset.
|
||||||
void Filter::subset (std::vector <Task>& output)
|
void Filter::subset (std::vector <Task>& output, bool applyContext /* = true */)
|
||||||
{
|
{
|
||||||
context.timer_filter.start ();
|
context.timer_filter.start ();
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ void Filter::subset (std::vector <Task>& output)
|
|||||||
context.debug (context.cli.dump ("Filter::subset"));
|
context.debug (context.cli.dump ("Filter::subset"));
|
||||||
|
|
||||||
bool shortcut = false;
|
bool shortcut = false;
|
||||||
std::string filterExpr = context.cli.getFilter ();
|
std::string filterExpr = context.cli.getFilter (applyContext);
|
||||||
if (filterExpr.length ())
|
if (filterExpr.length ())
|
||||||
{
|
{
|
||||||
context.timer_filter.stop ();
|
context.timer_filter.stop ();
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ public:
|
|||||||
Filter ();
|
Filter ();
|
||||||
~Filter ();
|
~Filter ();
|
||||||
|
|
||||||
void subset (const std::vector <Task>&, std::vector <Task>&);
|
void subset (const std::vector <Task>&, std::vector <Task>&, bool applyContext = true);
|
||||||
void subset (std::vector <Task>&);
|
void subset (std::vector <Task>&, bool applyContext = true);
|
||||||
bool pendingOnly ();
|
bool pendingOnly ();
|
||||||
void safety ();
|
void safety ();
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ int CmdExport::execute (std::string& output)
|
|||||||
// Apply filter.
|
// Apply filter.
|
||||||
Filter filter;
|
Filter filter;
|
||||||
std::vector <Task> filtered;
|
std::vector <Task> filtered;
|
||||||
filter.subset (filtered);
|
filter.subset (filtered, false);
|
||||||
|
|
||||||
// Obey 'limit:N'.
|
// Obey 'limit:N'.
|
||||||
int rows = 0;
|
int rows = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user