From 2f1ca72334afba905c3d8b13b8df6f2359bdf74c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 7 Jun 2015 15:34:33 -0400 Subject: [PATCH] Code: Improved comments regarding filters/args. --- src/CLI.cpp | 6 ++++-- src/commands/CmdCalendar.cpp | 3 +++ src/commands/CmdContext.cpp | 1 + src/commands/CmdCustom.cpp | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/CLI.cpp b/src/CLI.cpp index 65b9a669a..3581cd31b 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -671,7 +671,8 @@ void CLI::addArg (const std::string& arg) if (isTerminator (raw)) // -- _terminated = true; - // This is the case where the argument should not be lexed. + // This is the case where the argument should not be lexed, which is when it + // is a single entity, and recognized. if (_terminated || isRCOverride (raw) || // rc: isConfigOverride (raw) || // rc.: @@ -2365,7 +2366,8 @@ bool CLI::disqualifyFirstLastBinary ( } //////////////////////////////////////////////////////////////////////////////// -// Disqualify terms when there operators hidden by syntactic sugar. +// Disqualify terms when there are operators hidden by syntactic sugar. +// TODO This always returns false. Why bother? bool CLI::disqualifySugarFree ( const std::vector >& lexemes) const { diff --git a/src/commands/CmdCalendar.cpp b/src/commands/CmdCalendar.cpp index 41dba8410..5dac9b6f9 100644 --- a/src/commands/CmdCalendar.cpp +++ b/src/commands/CmdCalendar.cpp @@ -334,6 +334,9 @@ int CmdCalendar::execute (std::string& output) if (context.commands.find (report) == context.commands.end ()) throw std::string (STRING_ERROR_DETAILS); + // TODO Fix this: cal --> task + // calendar --> taskendar + // If the executable was "cal" or equivalent, replace it with "task". std::string executable = context.cli._args[0].attribute ("raw"); auto cal = executable.find ("cal"); diff --git a/src/commands/CmdContext.cpp b/src/commands/CmdContext.cpp index 76211b254..4a1233337 100644 --- a/src/commands/CmdContext.cpp +++ b/src/commands/CmdContext.cpp @@ -143,6 +143,7 @@ int CmdContext::defineContext (std::vector & words, std::stringstre try { + // This result is not used, and is just to check validity. context.cli.addRawFilter ("( " + value + " )"); filter.subset (pending, filtered); } diff --git a/src/commands/CmdCustom.cpp b/src/commands/CmdCustom.cpp index 973bd1613..b3eda4222 100644 --- a/src/commands/CmdCustom.cpp +++ b/src/commands/CmdCustom.cpp @@ -81,7 +81,8 @@ int CmdCustom::execute (std::string& output) split (sortOrder, reportSort, ','); validateSortColumns (sortOrder); - // Prepend the argument list with those from the report filter. + // Add the report filter to any existing filter from the command line or + // context. context.cli.addRawFilter (reportFilter); // Apply filter.