- The configuration file now supports JSON encoding of Unicode characters, by
  specifying \uNNNN.
This commit is contained in:
Paul Beckingham 2013-08-18 00:00:46 -04:00
parent 67f20d96bc
commit 74bbd6cefe
5 changed files with 12 additions and 5 deletions

View file

@ -32,6 +32,8 @@ Features
that are not yet modified. that are not yet modified.
+ ColPriority.cpp - Migration of column modification code out of Task.cpp and + ColPriority.cpp - Migration of column modification code out of Task.cpp and
into the individual column object. into the individual column object.
+ The configuration file now supports JSON encoding of Unicode characters, by
specifying \uNNNN.
+ Now requires libuuid (thanks to Martin Natano). + Now requires libuuid (thanks to Martin Natano).
Bugs Bugs

1
NEWS
View file

@ -20,6 +20,7 @@ New configuration options in taskwarrior 2.3.0
- 'taskd.credentials' specifies user credentials for the task server. - 'taskd.credentials' specifies user credentials for the task server.
- 'taskd.certificate' specifies the task server certificate. - 'taskd.certificate' specifies the task server certificate.
- 'debug.tls' shows TLS log information, for debugging. - 'debug.tls' shows TLS log information, for debugging.
- The configuration file supports JSON encoding of unicode characters \uNNNN.
Newly deprecated features in taskwarrior 2.3.0 Newly deprecated features in taskwarrior 2.3.0

View file

@ -80,6 +80,8 @@ The hash mark, or pound sign ("#") is used as a comment character. It can be
used to annotate the configuration file. All text after the character to the end used to annotate the configuration file. All text after the character to the end
of the line is ignored. of the line is ignored.
The configuration file supports UTF8 as well as JSON encoding, such as \\uNNNN.
Note that taskwarrior is flexible about the values used to represent Boolean Note that taskwarrior is flexible about the values used to represent Boolean
items. You can use "on", "yes", "y", "1" and "true". items. You can use "on", "yes", "y", "1" and "true".
Anything else means "off". Anything else means "off".

View file

@ -38,6 +38,7 @@
#include <Date.h> #include <Date.h>
#include <File.h> #include <File.h>
#include <Timer.h> #include <Timer.h>
#include <JSON.h>
#include <Config.h> #include <Config.h>
#include <text.h> #include <text.h>
#include <util.h> #include <util.h>
@ -496,7 +497,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */)
std::string key = trim (line.substr (0, equal), " \t"); // no i18n std::string key = trim (line.substr (0, equal), " \t"); // no i18n
std::string value = trim (line.substr (equal+1, line.length () - equal), " \t"); // no i18n std::string value = trim (line.substr (equal+1, line.length () - equal), " \t"); // no i18n
(*this)[key] = value; (*this)[key] = json::decode (value);
} }
else else
{ {
@ -551,7 +552,7 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data)
<< "\n"; << "\n";
// Write out the new file. // Write out the new file.
if (! File::write (rc, contents.str ())) if (! File::write (rc, json::encode (contents.str ())))
throw format (STRING_CONFIG_BAD_WRITE, rc); throw format (STRING_CONFIG_BAD_WRITE, rc);
} }

View file

@ -29,6 +29,7 @@
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include <Context.h> #include <Context.h>
#include <JSON.h>
#include <i18n.h> #include <i18n.h>
#include <text.h> #include <text.h>
#include <util.h> #include <util.h>
@ -103,9 +104,9 @@ int CmdConfig::execute (std::string& output)
if (confirm (format (STRING_CMD_CONFIG_CONFIRM, name, context.config.get (name), value))) if (confirm (format (STRING_CMD_CONFIG_CONFIRM, name, context.config.get (name), value)))
{ {
if (comment != std::string::npos) if (comment != std::string::npos)
*line = name + "=" + value + " " + line->substr (comment); *line = name + "=" + json::encode (value) + " " + line->substr (comment);
else else
*line = name + "=" + value; *line = name + "=" + json::encode (value);
change = true; change = true;
} }
@ -116,7 +117,7 @@ int CmdConfig::execute (std::string& output)
if (!found && if (!found &&
confirm (format (STRING_CMD_CONFIG_CONFIRM2, name, value))) confirm (format (STRING_CMD_CONFIG_CONFIRM2, name, value)))
{ {
contents.push_back (name + "=" + value); contents.push_back (name + "=" + json::encode (value));
change = true; change = true;
} }
} }