From ecdfb31553fb143d710092074ff09835963188b3 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 8 Nov 2008 23:32:29 -0500 Subject: [PATCH] - "task version" command now reports unrecognized configuration variables, which may be spelling mistakes or deprecated variables. --- ChangeLog | 2 ++ html/config.html | 10 ++++++++++ html/task.html | 2 ++ src/command.cpp | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7d05412eb..fdd4d643e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ + "task stop" can now remove the start time from a started task. + "task ghistory" now displays a differently aligned graph, allowing easier comparison by month of tasks added versus completed and deleted. + + "task version" command now reports unrecognized configuration variables, + which may be spelling mistakes or deprecated variables. ------ old releases ------------------------------ diff --git a/html/config.html b/html/config.html index 30db4d940..09add7bef 100644 --- a/html/config.html +++ b/html/config.html @@ -316,6 +316,16 @@ ID Project Pri Description whenever the shadow file is updated by some task command. +

+ Note that the command: +

+ +
task version
+ +

+ will display the configuration variables found in the .taskrc file, + and will warn you of any variables that are not recognized. +


diff --git a/html/task.html b/html/task.html index c93cbb5be..cd398f0a3 100644 --- a/html/task.html +++ b/html/task.html @@ -100,6 +100,8 @@
  • "task stop" can remove the start time from a started task.
  • "task ghistory" now displays a differently aligned graph, allowing easier comparison by month of tasks added versus completed and deleted. +
  • "task version" command now reports unrecognized configuration variables, + which may be spelling mistakes or deprecated variables.

    diff --git a/src/command.cpp b/src/command.cpp index a404dc399..3030d695c 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -355,6 +355,42 @@ std::string handleVersion (Config& conf) << link.render () << std::endl; + // Complain about configuration variables that are not recognized. + // These are the regular configuration variables. + std::string recognized = + "blanklines color color.active color.due color.overdue color.pri.H " + "color.pri.L color.pri.M color.pri.none color.tagged confirmation curses " + "data.location dateformat default.command default.priority defaultwidth due " + "monthsperline nag newest next oldest project shadow.command shadow.file " + "shadow.notify"; + + std::vector unrecognized; + foreach (i, all) + { + if (recognized.find (*i) == std::string::npos) + { + // These are special configuration variables, because their name is + // dynamic. + if (i->find ("color.keyword.") == std::string::npos && + i->find ("color.project.") == std::string::npos && + i->find ("color.tag.") == std::string::npos) + { + unrecognized.push_back (*i); + } + } + } + + if (unrecognized.size ()) + { + out << "Your .taskrc file contains these unrecognized variables:" + << std::endl; + + foreach (i, unrecognized) + out << " " << *i << std::endl; + + out << std::endl; + } + // Verify installation. This is mentioned in the documentation as the way to // ensure everything is properly installed.