Merge branch '2.3.0' of tasktools.org:task into 2.3.0

This commit is contained in:
Paul Beckingham 2013-09-07 12:36:20 -04:00
commit 70f4f9dbb2
11 changed files with 38 additions and 28 deletions

View file

@ -37,6 +37,7 @@ Features
+ Now requires libuuid (thanks to Martin Natano). + Now requires libuuid (thanks to Martin Natano).
+ New '_get' is a DOM accessor helper command. + New '_get' is a DOM accessor helper command.
+ New virtual tags (WEEK, MONTH, YEAR, PARENT). + New virtual tags (WEEK, MONTH, YEAR, PARENT).
+ Added the 'remaining' format for all date columns.
Bugs Bugs
+ #1196 Now builds on Hurd (thanks to Jakub Wilk). + #1196 Now builds on Hurd (thanks to Jakub Wilk).

1
NEWS
View file

@ -9,6 +9,7 @@ New Features in taskwarrior 2.3.0
- Now requires libuuid. - Now requires libuuid.
- New '_get' DOM accessor helper command. - New '_get' DOM accessor helper command.
- New virtual tags: WEEK, MONTH, YEAR, PARENT. - New virtual tags: WEEK, MONTH, YEAR, PARENT.
- New 'remaining' format for date columns.
New commands in taskwarrior 2.3.0 New commands in taskwarrior 2.3.0

View file

@ -1204,11 +1204,8 @@ The description for report X when running the "task help" command.
.TP .TP
.B report.X.columns .B report.X.columns
The columns that will be used when generating the report X. Valid columns are: This is a comma-separated list of columns and formatting specifiers. See the
id, uuid, status, project, priority, priority_long, entry, start, end, due, command 'task columns' for a full list of options and examples.
countdown, countdown_compact, age, age_compact, active, tags, depends,
description_only, description, recur, recurrence_indicator, tag_indicator and
wait. The IDs are separated by commas.
.TP .TP
.B report.X.labels .B report.X.labels
@ -1222,7 +1219,7 @@ specified by using the column ids post-fixed by a "+" for ascending sort order
or a "-" for descending sort order. The sort IDs are separated by commas. or a "-" for descending sort order. The sort IDs are separated by commas.
For example: For example:
report.list.sort=due+,priority-,active-,project+ report.list.sort=due+,priority-,start.active-,project+
.TP .TP
.B report.X.filter .B report.X.filter

View file

@ -26,7 +26,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <cmake.h> #include <cmake.h>
#include <stdlib.h>
#include <math.h> #include <math.h>
#include <Context.h> #include <Context.h>
#include <ColDate.h> #include <ColDate.h>
@ -50,6 +49,8 @@ ColumnDate::ColumnDate ()
_styles.push_back ("epoch"); _styles.push_back ("epoch");
_styles.push_back ("iso"); _styles.push_back ("iso");
_styles.push_back ("age"); _styles.push_back ("age");
_styles.push_back ("remaining");
_styles.push_back ("countdown");
Date now; Date now;
now -= 125; // So that "age" is non-zero. now -= 125; // So that "age" is non-zero.
@ -58,6 +59,8 @@ ColumnDate::ColumnDate ()
_examples.push_back (now.toEpochString ()); _examples.push_back (now.toEpochString ());
_examples.push_back (now.toISO ()); _examples.push_back (now.toISO ());
_examples.push_back (Duration (Date () - now).formatCompact ()); _examples.push_back (Duration (Date () - now).formatCompact ());
_examples.push_back ("");
_examples.push_back (Duration (Date () - now).format ());
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -79,7 +82,7 @@ void ColumnDate::measure (Task& task, unsigned int& minimum, unsigned int& maxim
if (task.has (_name)) if (task.has (_name))
{ {
Date date ((time_t) strtol (task.get (_name).c_str (), NULL, 10)); Date date (task.get_date (_name));
if (_style == "default" || if (_style == "default" ||
_style == "formatted") _style == "formatted")
@ -98,7 +101,6 @@ void ColumnDate::measure (Task& task, unsigned int& minimum, unsigned int& maxim
} }
else if (_style == "countdown") else if (_style == "countdown")
{ {
Date date ((time_t) strtol (task.get (_name).c_str (), NULL, 10));
Date now; Date now;
minimum = maximum = Duration (now - date).format ().length (); minimum = maximum = Duration (now - date).format ().length ();
} }
@ -119,6 +121,12 @@ void ColumnDate::measure (Task& task, unsigned int& minimum, unsigned int& maxim
Date now; Date now;
minimum = maximum = Duration (now - date).formatCompact ().length (); minimum = maximum = Duration (now - date).formatCompact ().length ();
} }
else if (_style == "remaining")
{
Date now;
if (date > now)
minimum = maximum = Duration (date - now).format ().length ();
}
else else
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style); throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
} }
@ -133,6 +141,8 @@ void ColumnDate::render (
{ {
if (task.has (_name)) if (task.has (_name))
{ {
Date date (task.get_date (_name));
if (_style == "default" || if (_style == "default" ||
_style == "formatted") _style == "formatted")
{ {
@ -149,12 +159,10 @@ void ColumnDate::render (
lines.push_back ( lines.push_back (
color.colorize ( color.colorize (
leftJustify ( leftJustify (
Date ((time_t) strtol (task.get (_name).c_str (), NULL, 10)) date.toString (format), width)));
.toString (format), width)));
} }
else if (_style == "countdown") else if (_style == "countdown")
{ {
Date date ((time_t) strtol (task.get (_name).c_str (), NULL, 10));
Date now; Date now;
lines.push_back ( lines.push_back (
@ -167,28 +175,24 @@ void ColumnDate::render (
lines.push_back ( lines.push_back (
color.colorize ( color.colorize (
rightJustify ( rightJustify (
format (Date ((time_t) strtol (task.get (_name).c_str (), NULL, 10)) format (date.toJulian (), 13, 12), width)));
.toJulian (), 13, 12), width)));
} }
else if (_style == "epoch") else if (_style == "epoch")
{ {
lines.push_back ( lines.push_back (
color.colorize ( color.colorize (
rightJustify ( rightJustify (
Date ((time_t) strtol (task.get (_name).c_str (), NULL, 10)) date.toEpochString (), width)));
.toEpochString (), width)));
} }
else if (_style == "iso") else if (_style == "iso")
{ {
lines.push_back ( lines.push_back (
color.colorize ( color.colorize (
leftJustify ( leftJustify (
Date ((time_t) strtol (task.get (_name).c_str (), NULL, 10)) date.toISO (), width)));
.toISO (), width)));
} }
else if (_style == "age") else if (_style == "age")
{ {
Date date ((time_t) strtol (task.get (_name).c_str (), NULL, 10));
Date now; Date now;
lines.push_back ( lines.push_back (
@ -196,6 +200,17 @@ void ColumnDate::render (
leftJustify ( leftJustify (
Duration (now - date).formatCompact (), width))); Duration (now - date).formatCompact (), width)));
} }
else if (_style == "remaining")
{
Date now;
if (date > now)
lines.push_back (
color.colorize (
rightJustify (
Duration (date - now).format (), width)));
else
lines.push_back ("");
}
} }
} }

View file

@ -42,8 +42,6 @@ ColumnDue::ColumnDue ()
_name = "due"; _name = "due";
_label = STRING_COLUMN_LABEL_DUE; _label = STRING_COLUMN_LABEL_DUE;
_styles.push_back ("countdown");
Date now; Date now;
now += 125; now += 125;
_examples.push_back (Duration (now - Date ()).formatCompact ()); _examples.push_back (Duration (now - Date ()).formatCompact ());

View file

@ -41,12 +41,6 @@ ColumnScheduled::ColumnScheduled ()
{ {
_name = "scheduled"; _name = "scheduled";
_label = STRING_COLUMN_LABEL_SCHED; _label = STRING_COLUMN_LABEL_SCHED;
_styles.push_back ("countdown");
Date now;
now += 125;
_examples.push_back (Duration (now - Date ()).formatCompact ());
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -51,7 +51,7 @@ int CmdGet::execute (std::string& output)
// have already been handled. // have already been handled.
std::vector <std::string> words = context.a3.extract_words (); std::vector <std::string> words = context.a3.extract_words ();
if (words.size () == 0) if (words.size () == 0)
throw std::string ("Need args!"); throw std::string (STRING_CMD_GET_NO_DOM);
std::vector <std::string> results; std::vector <std::string> results;
std::vector <std::string>::iterator word; std::vector <std::string>::iterator word;

View file

@ -308,6 +308,7 @@
#define STRING_CMD_SUMMARY_NONE "(none)" #define STRING_CMD_SUMMARY_NONE "(none)"
#define STRING_CMD_COUNT_USAGE "Counts matching tasks" #define STRING_CMD_COUNT_USAGE "Counts matching tasks"
#define STRING_CMD_GET_USAGE "DOM Accessor" #define STRING_CMD_GET_USAGE "DOM Accessor"
#define STRING_CMD_GET_NO_DOM "No DOM reference specified."
#define STRING_CMD_UDAS_NO "No UDAs defined." #define STRING_CMD_UDAS_NO "No UDAs defined."
#define STRING_CMD_UDAS_SUMMARY "{1} UDA defined" #define STRING_CMD_UDAS_SUMMARY "{1} UDA defined"

View file

@ -317,6 +317,7 @@
#define STRING_CMD_SUMMARY_NONE "(ninguna)" #define STRING_CMD_SUMMARY_NONE "(ninguna)"
#define STRING_CMD_COUNT_USAGE "Cuenta tareas que coinciden" #define STRING_CMD_COUNT_USAGE "Cuenta tareas que coinciden"
#define STRING_CMD_GET_USAGE "DOM Accessor" #define STRING_CMD_GET_USAGE "DOM Accessor"
#define STRING_CMD_GET_NO_DOM "No DOM reference specified."
#define STRING_CMD_UDAS_NO "Ningún UDA definido." #define STRING_CMD_UDAS_NO "Ningún UDA definido."
#define STRING_CMD_UDAS_SUMMARY "{1} UDA definido" #define STRING_CMD_UDAS_SUMMARY "{1} UDA definido"

View file

@ -308,6 +308,7 @@
#define STRING_CMD_SUMMARY_NONE "(none)" #define STRING_CMD_SUMMARY_NONE "(none)"
#define STRING_CMD_COUNT_USAGE "Counts matching tasks" #define STRING_CMD_COUNT_USAGE "Counts matching tasks"
#define STRING_CMD_GET_USAGE "DOM Accessor" #define STRING_CMD_GET_USAGE "DOM Accessor"
#define STRING_CMD_GET_NO_DOM "No DOM reference specified."
#define STRING_CMD_UDAS_NO "No UDAs defined." #define STRING_CMD_UDAS_NO "No UDAs defined."
#define STRING_CMD_UDAS_SUMMARY "{1} UDA defined" #define STRING_CMD_UDAS_SUMMARY "{1} UDA defined"

View file

@ -309,6 +309,7 @@
#define STRING_CMD_SUMMARY_NONE "(nessuno)" #define STRING_CMD_SUMMARY_NONE "(nessuno)"
#define STRING_CMD_COUNT_USAGE "Conteggia task corrispondenti" #define STRING_CMD_COUNT_USAGE "Conteggia task corrispondenti"
#define STRING_CMD_GET_USAGE "DOM Accessor" #define STRING_CMD_GET_USAGE "DOM Accessor"
#define STRING_CMD_GET_NO_DOM "No DOM reference specified."
#define STRING_CMD_UDAS_NO "Nessun UDA definito." #define STRING_CMD_UDAS_NO "Nessun UDA definito."
#define STRING_CMD_UDAS_SUMMARY "{1} UDA definito" #define STRING_CMD_UDAS_SUMMARY "{1} UDA definito"