From b4ab5fcfac33d3fa2c7800401a7a1cacce777126 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 30 Aug 2014 23:33:47 -0400 Subject: [PATCH] CmdCalendar - Replaced code that tried to reuse the Context object to reparse the command line in order to run the calendar.details.report, with a fork/exec alternative that doesn't require acrobatics. --- src/commands/CmdCalendar.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/commands/CmdCalendar.cpp b/src/commands/CmdCalendar.cpp index fa67c3333..8b1ba42ac 100644 --- a/src/commands/CmdCalendar.cpp +++ b/src/commands/CmdCalendar.cpp @@ -336,21 +336,19 @@ int CmdCalendar::execute (std::string& output) if (context.commands.find (report) == context.commands.end ()) throw std::string (STRING_ERROR_DETAILS); - std::string report_filter = context.config.get ("report." + report + ".filter"); + std::string executable = context.parser.tree ()->_branches[0]->attribute ("raw"); - context.parser.clear (); - context.parser.captureFirst ("task"); - context.parser.parse (); - - report_filter += " due.after:" + after + " due.before:" + before + " -nocal"; - context.config.set ("report." + report + ".filter", report_filter); - - // Display all due tasks in the report colorized not only the imminent - // ones. - context.config.set ("due", 0); + std::vector args; + args.push_back ("rc:" + context.rc_file._data); + args.push_back ("rc.due:0"); + args.push_back ("rc.verbose:label,affected,blank"); + args.push_back ("due.after:" + after); + args.push_back ("due.before:" + before); + args.push_back ("-nocal"); + args.push_back (report); std::string output; - context.commands[report]->execute (output); + ::execute (executable, args, "", output); out << output; }