From dc1760769fd55fcbdc40fb471cf5278bf8b9d950 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 19 Jul 2008 14:56:36 -0400 Subject: [PATCH 01/12] - Bumped version number to 1.5.0 --- ChangeLog | 9 ++++++--- configure.ac | 2 +- html/task.html | 13 +++++-------- html/versions.html | 14 ++++++++++++++ 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 606cbf7ac..3bbf572d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,12 +7,15 @@ represents a feature release, and the Z represents a patch. ------ current release --------------------------- -1.4.1 (7/?/2008) +1.5.0 (?/?/?) + +------ old releases ------------------------------ + +1.4.1 (7/18/2008) + Bug: Descriptions can not be altered with "task 123 New description" + Tweak: For "task calendar" month names are now centered over the month + Removed TUTORIAL file contents in favor of online version - ------- old releases ------------------------------ + + Provided Mac .pkg binary 1.4.0 (7/10/2008) + New recurring tasks feature diff --git a/configure.ac b/configure.ac index d9f7bbeb4..e89a1aa53 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT(task, 1.4.1, bugs@beckingham.net) +AC_INIT(task, 1.5.0, bugs@beckingham.net) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/task.cpp]) AC_CONFIG_HEADER([auto.h]) diff --git a/html/task.html b/html/task.html index a2458ea92..84f28544e 100644 --- a/html/task.html +++ b/html/task.html @@ -75,11 +75,11 @@ - + - +
Source:task-1.4.1.tar.gztask-1.5.0.tar.gz
Mac OS X 10.5 (Leopard) Intel-only:task-1.4.1.pkgtask-1.5.0.pkg
-

New in version 1.4.1 (7/18/2008)

+

New in version 1.5.0 (?/?/?)

diff --git a/html/versions.html b/html/versions.html index 30df5851f..e6e3ffe4f 100644 --- a/html/versions.html +++ b/html/versions.html @@ -35,6 +35,20 @@

+

+

New in version 1.4.1 (7/18/2008)

+ task-1.4.1.tar.gz +
+ Mac OS X 10.5 (Leopard) Intel-only: + task-1.4.1.pkg +

+ +

New in version 1.4.0 (7/10/2008)

Source: task-1.4.0.tar.gz From d265ac6c2d8737c4b2f75f7b3d0b4389ea4a4e5e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 19 Jul 2008 22:12:01 -0400 Subject: [PATCH 02/12] - Implemented "task undo" to counteract "task do". --- ChangeLog | 4 +++- html/task.html | 3 ++- src/command.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ src/parse.cpp | 1 + src/task.cpp | 5 +++++ src/task.h | 1 + 6 files changed, 55 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bbf572d8..3342bfba3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,9 @@ represents a feature release, and the Z represents a patch. ------ current release --------------------------- -1.5.0 (?/?/?) +1.5.0 (?/?/2008) + + "task undo" can now retract a "task done" command, provided no reports + have been run (and therefore TDB::gc run) ------ old releases ------------------------------ diff --git a/html/task.html b/html/task.html index 84f28544e..b536566dd 100644 --- a/html/task.html +++ b/html/task.html @@ -94,7 +94,8 @@

New in version 1.5.0 (?/?/?)

    -
  • +
  • "task undo" can now retract a "task done" command, provided no + reports have been run.

diff --git a/src/command.cpp b/src/command.cpp index 5344a4037..91a3053f2 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -203,6 +203,49 @@ void handleUndelete (TDB& tdb, T& task, Config& conf) << "command is run immediately after the errant delete command." << std::endl; } +//////////////////////////////////////////////////////////////////////////////// +// If a task is done, but is still in the pending file, then it may be undone +// simply by changing it's status. +void handleUndo (TDB& tdb, T& task, Config& conf) +{ + std::vector all; + tdb.allPendingT (all); + + int id = task.getId (); + std::vector ::iterator it; + for (it = all.begin (); it != all.end (); ++it) + { + if (it->getId () == id) + { + if (it->getStatus () == T::completed) + { + if (it->getAttribute ("recur") != "") + { + std::cout << "Task does not support 'undo' for recurring tasks." << std::endl; + return; + } + + T restored (*it); + restored.setStatus (T::pending); + restored.removeAttribute ("end"); + tdb.modifyT (restored); + + std::cout << "Task " << id << " successfully undone." << std::endl; + return; + } + else + { + std::cout << "Task " << id << " is not done - therefore cannot be undone." << std::endl; + return; + } + } + } + + std::cout << "Task " << id + << " not found - tasks can only be reliably undone if the undo" << std::endl + << "command is run immediately after the errant done command." << std::endl; +} + //////////////////////////////////////////////////////////////////////////////// void handleVersion (Config& conf) { diff --git a/src/parse.cpp b/src/parse.cpp index 770c2b2f0..a8bba1e57 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -141,6 +141,7 @@ static const char* commands[] = "summary", "tags", "undelete", + "undo", "usage", "version", "", diff --git a/src/task.cpp b/src/task.cpp index 0d3f6c7f5..cc192e18e 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -125,6 +125,10 @@ static void shortUsage (Config& conf) table.addCell (row, 1, "task done ID"); table.addCell (row, 2, "Marks the specified task as completed"); + row = table.addRow (); + table.addCell (row, 1, "task undo ID"); + table.addCell (row, 2, "Marks the specified done task as pending, provided a report has not yet been run"); + row = table.addRow (); table.addCell (row, 1, "task projects"); table.addCell (row, 2, "Shows a list of all project names used, and how many tasks are in each"); @@ -316,6 +320,7 @@ int main (int argc, char** argv) else if (command == "delete") handleDelete (tdb, task, conf); else if (command == "start") handleStart (tdb, task, conf); else if (command == "done") handleDone (tdb, task, conf); + else if (command == "undo") handleUndo (tdb, task, conf); else if (command == "export") handleExport (tdb, task, conf); else if (command == "version") handleVersion ( conf); else if (command == "summary") handleReportSummary (tdb, task, conf); diff --git a/src/task.h b/src/task.h index 4a8dc78fd..ced6b3c18 100644 --- a/src/task.h +++ b/src/task.h @@ -76,6 +76,7 @@ void handleExport (TDB&, T&, Config&); void handleDelete (TDB&, T&, Config&); void handleStart (TDB&, T&, Config&); void handleDone (TDB&, T&, Config&); +void handleUndo (TDB&, T&, Config&); void handleModify (TDB&, T&, Config&); void handleColor (Config&); From 29a152edb05d529c7e7fb8821e6e44bdee224f8a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 26 Aug 2008 09:57:46 -0400 Subject: [PATCH 03/12] - Migrated 1.5.0 changes thus far into 1.4.2. --- ChangeLog | 2 +- configure.ac | 2 +- html/task.html | 8 ++++---- ideas.txt | 48 ------------------------------------------------ 4 files changed, 6 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3342bfba3..d9fc85a68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,7 @@ represents a feature release, and the Z represents a patch. ------ current release --------------------------- -1.5.0 (?/?/2008) +1.4.2 (8/26/2008) + "task undo" can now retract a "task done" command, provided no reports have been run (and therefore TDB::gc run) diff --git a/configure.ac b/configure.ac index e89a1aa53..9d7bc2d33 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT(task, 1.5.0, bugs@beckingham.net) +AC_INIT(task, 1.4.2, bugs@beckingham.net) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/task.cpp]) AC_CONFIG_HEADER([auto.h]) diff --git a/html/task.html b/html/task.html index b536566dd..430625e36 100644 --- a/html/task.html +++ b/html/task.html @@ -75,11 +75,11 @@ - + - +
Source:task-1.5.0.tar.gztask-1.4.2.tar.gz
Mac OS X 10.5 (Leopard) Intel-only:task-1.5.0.pkgtask-1.4.2.pkg
-

New in version 1.5.0 (?/?/?)

+

New in version 1.4.2 (?/?/?)

  • "task undo" can now retract a "task done" command, provided no reports have been run. diff --git a/ideas.txt b/ideas.txt index 261044c07..09cea7499 100644 --- a/ideas.txt +++ b/ideas.txt @@ -20,51 +20,3 @@ Test Suite - debug=on to cause all cout to be csv - regression tests for every bug, command, feature -Recurrence - + new T::status recurring (stored as R) - + new user-specifiable attributes - recur: [until:] - + duration: - daily, day, 1d - Nd - weekly, 1w - Nw - biweekly - monthly, 1m - bimonthly - Nm - quarterly, 1q - Nq - biannual, biyearly - annual, yearly, 1y - Na, Ny - + recur: without due: => Error - + until: without recur: => Error - + New file format: supports status R, recur:, until:, base:, range: - - on TDB.gc, adjust base: and compress range: for T::status == recurring - - all recurring tasks are removed from lists by T::*pendingT, and a synthetic - addendum is generated - - when a recurring task is completed, range: is updated, and a synthetic - task is added to completed.data that retains the attributes of the root - - - Scenario: - # Today = 6/22/2008 - % task add Friday due:6/15/2008 recur:weekly until 8/1/2008 - # task must generate a base and range - # base:6/15/2008 - # range:------- - # ^6/15 - # ^6/22 - # ^6/29 - # ^7/6 - # ^7/13 - # ^7/20 - # ^7/27 - % task ls - 1 Friday 6/15/2008 .lte. today (overdue) - 2 Friday 6/22/2008 .lte. today (due) - 3 Friday 6/29/2008 one recurrence - 4 Friday 7/6/2008 (not shown) - 5 Friday 7/13/2008 (not shown) - 6 Friday 7/20/2008 (not shown) - 7 Friday 7/27/2008 (not shown) - From 11225eb599d4cea9a748216aaf7d4ae5a1377b2a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 12 Sep 2008 10:28:14 -0400 Subject: [PATCH 04/12] - Applied patch from Andy Lester to correct Table sorting to use the entire string instead of just the initial characters. --- ChangeLog | 4 +++- NEWS | 1 + html/task.html | 2 ++ src/Table.cpp | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9fc85a68..46bc94d04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,9 +7,11 @@ represents a feature release, and the Z represents a patch. ------ current release --------------------------- -1.4.2 (8/26/2008) +1.4.2 (9/12/2008) + "task undo" can now retract a "task done" command, provided no reports have been run (and therefore TDB::gc run) + + Task now correctly sorts on entire strings, instead of just the first + character (thanks to Andy Lester) ------ old releases ------------------------------ diff --git a/NEWS b/NEWS index de3298f15..18b4251e8 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ Task has been built and tested on the following configurations: - Fedora Core 8 - Fedora Core 9 - Ubuntu 8 Hardy Heron + - Ubuntu 9 Feisty Fawn - Solaris 10 - Cygwin 1.5.25-14 diff --git a/html/task.html b/html/task.html index 8eacbdbd5..f87644136 100644 --- a/html/task.html +++ b/html/task.html @@ -94,6 +94,8 @@
    • "task undo" can now retract a "task done" command, provided no reports have been run. +
    • Task now correctly sorts on entire strings, instead of just the + first character (thanks to Andy Lester).

    diff --git a/src/Table.cpp b/src/Table.cpp index 89f65bdf9..e8cabef68 100644 --- a/src/Table.cpp +++ b/src/Table.cpp @@ -758,12 +758,12 @@ void Table::sort (std::vector & order) break; case ascendingCharacter: - if ((char)*left > (char)*right) + if ((std::string)*left > (std::string)*right) SWAP break; case descendingCharacter: - if ((char)*left < (char)*right) + if ((std::string)*left < (std::string)*right) SWAP break; From 4abc722eff8223791f7c17b68a928edf1850413c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 12 Sep 2008 11:27:25 -0400 Subject: [PATCH 05/12] - Task now uses dashes (-----) to underline column headings when color is disabled (thanks for Vincent Fleuranceau). --- ChangeLog | 2 ++ html/config.html | 2 ++ html/task.html | 4 ++- src/Table.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++++++- src/Table.h | 3 +++ src/report.cpp | 32 +++++++++++++++++++++- 6 files changed, 110 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46bc94d04..8071d3259 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ represents a feature release, and the Z represents a patch. have been run (and therefore TDB::gc run) + Task now correctly sorts on entire strings, instead of just the first character (thanks to Andy Lester) + + Task now uses dashes (-----) to column underlines when color is disabled + (thanks to Vincent Fleuranceau) ------ old releases ------------------------------ diff --git a/html/config.html b/html/config.html index b241b8d92..609e36d75 100644 --- a/html/config.html +++ b/html/config.html @@ -210,6 +210,8 @@

    color
    May be "on" or "off". Determines whether task uses color. + When "off", task will use dashes (-----) to underline column + headings.
    diff --git a/html/task.html b/html/task.html index f87644136..3b1893d1d 100644 --- a/html/task.html +++ b/html/task.html @@ -90,12 +90,14 @@ -

    New in version 1.4.2 (?/?/?)

    +

    New in version 1.4.2 (9/12/2008)

    • "task undo" can now retract a "task done" command, provided no reports have been run.
    • Task now correctly sorts on entire strings, instead of just the first character (thanks to Andy Lester). +
    • Task now uses dashes (-----) to underline column headings when + color is disabled (thanks to Vincent Fleuranceau).

    diff --git a/src/Table.cpp b/src/Table.cpp index e8cabef68..6de729b4b 100644 --- a/src/Table.cpp +++ b/src/Table.cpp @@ -54,6 +54,7 @@ Table::Table () : mRows (0) , mIntraPadding (1) + , mDashedUnderline (false) , mTablePadding (0) , mTableWidth (0) , mSuppressWS (false) @@ -103,6 +104,12 @@ void Table::setTableWidth (int width) mTableWidth = width; } +//////////////////////////////////////////////////////////////////////////////// +void Table::setTableDashedUnderline () +{ + mDashedUnderline = true; +} + //////////////////////////////////////////////////////////////////////////////// int Table::addColumn (const std::string& col) { @@ -582,7 +589,57 @@ const std::string Table::formatHeader ( fg, bg, Text::colorize ( decoration, Text::nocolor, - pad + preJust+ data + postJust + pad) + intraPad); + pad + preJust + data + postJust + pad) + intraPad); +} + +//////////////////////////////////////////////////////////////////////////////// +// data One Data to be rendered +// width 8 Max data width for column/specified width +// padding 1 Extra padding around data +// intraPadding 0 Extra padding between columns only +// justification right Alignment withing padding +// +// Returns: +// "------- " +// ------- data +// ^ ^ padding +// ^ intraPadding +// ^^^^^^^^ width +// ^ ^ fg/bg +// +const std::string Table::formatHeaderDashedUnderline ( + int col, + int width, + int padding) +{ + assert (width > 0); + + Text::color fg = getHeaderFg (col); + Text::color bg = getHeaderBg (col); + Text::color decoration = getHeaderUnderline (col); + + std::string data = ""; + for (int i = 0; i < width; ++i) + data += '-'; + + std::string pad = ""; + std::string intraPad = ""; + std::string attrOn = ""; + std::string attrOff = ""; + + for (int i = 0; i < padding; ++i) + pad += " "; + + // Place the value within the available space - justify. + if (col < (signed) mColumns.size () - 1) + for (int i = 0; i < getIntraPadding (); ++i) + intraPad += " "; + + return Text::colorize ( + fg, bg, + Text::colorize ( + decoration, Text::nocolor, + pad + data + pad) + intraPad); } //////////////////////////////////////////////////////////////////////////////// @@ -861,13 +918,24 @@ const std::string Table::render () // Print column headers in column order. std::string output; + std::string underline; for (size_t col = 0; col < mColumns.size (); ++col) + { output += formatHeader ( col, mCalculatedWidth[col], mColumnPadding[col]); + if (mDashedUnderline) + underline += formatHeaderDashedUnderline ( + col, + mCalculatedWidth[col], + mColumnPadding[col]); + } + output += "\n"; + if (underline.length ()) + output += underline + "\n"; // Determine row order, according to sort options. std::vector order; diff --git a/src/Table.h b/src/Table.h index 7428453ec..6a793af0c 100644 --- a/src/Table.h +++ b/src/Table.h @@ -51,6 +51,7 @@ public: void setTablePadding (int); void setTableIntraPadding (int); void setTableWidth (int); + void setTableDashedUnderline (); int addColumn (const std::string&); void setColumnColor (int, Text::color, Text::color); @@ -98,6 +99,7 @@ private: just getJustification (const int, const int); just getHeaderJustification (const int); const std::string formatHeader (const int, const int, const int); + const std::string formatHeaderDashedUnderline (const int, const int, const int); void formatCell (const int, const int, const int, const int, std::vector &, std::string&); void optimize (std::string&); void sort (std::vector &); @@ -110,6 +112,7 @@ private: std::map mFg; std::map mBg; std::map mUnderline; + bool mDashedUnderline; // Padding... int mTablePadding; diff --git a/src/report.cpp b/src/report.cpp index e0ec8db90..c3c928b28 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -143,7 +143,7 @@ void handleList (TDB& tdb, T& task, Config& conf) if (showAge) table.addColumn ("Age"); table.addColumn ("Description"); - if (conf.get ("color", true)) + if (conf.get (std::string ("color"), true)) { table.setColumnUnderline (0); table.setColumnUnderline (1); @@ -153,6 +153,8 @@ void handleList (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (5); if (showAge) table.setColumnUnderline (6); } + else + table.setTableDashedUnderline (); table.setColumnWidth (0, Table::minimum); table.setColumnWidth (1, Table::minimum); @@ -291,6 +293,8 @@ void handleSmallList (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (2); table.setColumnUnderline (3); } + else + table.setTableDashedUnderline (); table.setColumnWidth (0, Table::minimum); table.setColumnWidth (1, Table::minimum); @@ -414,6 +418,8 @@ void handleCompleted (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (1); table.setColumnUnderline (2); } + else + table.setTableDashedUnderline (); table.setColumnWidth (0, Table::minimum); table.setColumnWidth (1, Table::minimum); @@ -493,6 +499,8 @@ void handleInfo (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (0); table.setColumnUnderline (1); } + else + table.setTableDashedUnderline (); table.setColumnWidth (0, Table::minimum); table.setColumnWidth (1, Table::minimum); @@ -710,6 +718,8 @@ void handleLongList (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (7); if (showAge) table.setColumnUnderline (8); } + else + table.setTableDashedUnderline (); table.setColumnWidth (0, Table::minimum); table.setColumnWidth (1, Table::minimum); @@ -913,6 +923,8 @@ void handleReportSummary (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (2); table.setColumnUnderline (3); } + else + table.setTableDashedUnderline (); table.setColumnJustification (1, Table::right); table.setColumnJustification (2, Table::right); @@ -1056,6 +1068,8 @@ void handleReportNext (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (5); if (showAge) table.setColumnUnderline (6); } + else + table.setTableDashedUnderline (); table.setColumnWidth (0, Table::minimum); table.setColumnWidth (1, Table::minimum); @@ -1275,6 +1289,8 @@ void handleReportHistory (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (4); table.setColumnUnderline (5); } + else + table.setTableDashedUnderline (); table.setColumnJustification (2, Table::right); table.setColumnJustification (3, Table::right); @@ -1462,6 +1478,8 @@ void handleReportGHistory (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (0); table.setColumnUnderline (1); } + else + table.setTableDashedUnderline (); // Determine the longest line. int maxLine = 0; @@ -1623,6 +1641,8 @@ void handleReportUsage (const TDB& tdb, T& task, Config& conf) table.setColumnUnderline (0); table.setColumnUnderline (1); } + else + table.setTableDashedUnderline (); table.setColumnJustification (1, Table::right); table.sortOn (1, Table::descendingNumeric); @@ -1681,6 +1701,8 @@ std::string renderMonths ( table.setColumnUnderline (i + 6); table.setColumnUnderline (i + 7); } + else + table.setTableDashedUnderline (); table.setColumnJustification (i + 0, Table::right); table.setColumnJustification (i + 1, Table::right); @@ -1896,6 +1918,8 @@ void handleReportActive (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (3); table.setColumnUnderline (4); } + else + table.setTableDashedUnderline (); table.setColumnWidth (0, Table::minimum); table.setColumnWidth (1, Table::minimum); @@ -2011,6 +2035,8 @@ void handleReportOverdue (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (3); table.setColumnUnderline (4); } + else + table.setTableDashedUnderline (); table.setColumnWidth (0, Table::minimum); table.setColumnWidth (1, Table::minimum); @@ -2126,6 +2152,8 @@ void handleReportOldest (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (5); if (showAge) table.setColumnUnderline (6); } + else + table.setTableDashedUnderline (); table.setColumnWidth (0, Table::minimum); table.setColumnWidth (1, Table::minimum); @@ -2269,6 +2297,8 @@ void handleReportNewest (TDB& tdb, T& task, Config& conf) table.setColumnUnderline (5); if (showAge) table.setColumnUnderline (6); } + else + table.setTableDashedUnderline (); table.setColumnWidth (0, Table::minimum); table.setColumnWidth (1, Table::minimum); From 4380c7c712f92bb280e3b55594d335565bcd35ff Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 12 Sep 2008 11:40:46 -0400 Subject: [PATCH 06/12] - Task now allows mixed case attributes names (pri:, PRI:, Pri: ...) and commands (add, ADD, Ad ...) (thanks to Vincent Fleuranceau) --- AUTHORS | 4 ++-- ChangeLog | 2 ++ html/task.html | 2 ++ src/parse.cpp | 11 ++++++----- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/AUTHORS b/AUTHORS index ffcf9c092..a90a432e7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,6 +3,7 @@ Principal Author: Contributing Authors: Damian Glenny + Andy Lester With thanks to: Eugene Kramer @@ -14,5 +15,4 @@ With thanks to: galvanizd H. İbrahim Güngör Stas Antons - Andy Lester - + Vincent Fleuranceau diff --git a/ChangeLog b/ChangeLog index 8071d3259..bfdcfd9d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ represents a feature release, and the Z represents a patch. character (thanks to Andy Lester) + Task now uses dashes (-----) to column underlines when color is disabled (thanks to Vincent Fleuranceau) + + Task now allows mixed case attribute names (pri:, PRI:, Pri: ...) and + commands (add, ADD, Add ...) (thanks to Vincent Fleuranceau) ------ old releases ------------------------------ diff --git a/html/task.html b/html/task.html index 3b1893d1d..12882c036 100644 --- a/html/task.html +++ b/html/task.html @@ -98,6 +98,8 @@ first character (thanks to Andy Lester).

  • Task now uses dashes (-----) to underline column headings when color is disabled (thanks to Vincent Fleuranceau). +
  • Task now allows mixed case attribute names (pri:, PRI:, Pri: ...) + and commands (add, ADD, Add ...) (thanks to Vincent Fleuranceau).

diff --git a/src/parse.cpp b/src/parse.cpp index a8bba1e57..4dcd3bdbd 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -371,8 +371,8 @@ void parse ( std::string to; // An id is the first argument found that contains all digits. - if (command != "add" && // "add" doesn't require an ID - task.getId () == 0 && + if (lowerCase (command) != "add" && // "add" doesn't require an ID + task.getId () == 0 && validId (arg)) task.setId (::atoi (arg.c_str ())); @@ -389,7 +389,7 @@ void parse ( // value. else if ((colon = arg.find (":")) != std::string::npos) { - std::string name = arg.substr (0, colon); + std::string name = lowerCase (arg.substr (0, colon)); std::string value = arg.substr (colon + 1, std::string::npos); if (validAttribute (name, value, conf)) @@ -413,8 +413,9 @@ void parse ( // Command. else if (command == "") { - if (isCommand (arg) && validCommand (arg)) - command = arg; + std::string l = lowerCase (arg); + if (isCommand (l) && validCommand (l)) + command = l; else descCandidate += arg; // throw std::string ("'") + arg + "' is not a valid command."; From 4f8f04464494b798509e5a84818f3ccf6ab24f1b Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 12 Sep 2008 12:14:26 -0400 Subject: [PATCH 07/12] - Task now supports a default project and priority for new tasks, via the new "default.project" and "default.priority" configuration variables (thanks to Vincent Fleuranceau). --- ChangeLog | 3 +++ html/config.html | 10 ++++++++++ html/task.html | 3 +++ src/command.cpp | 14 ++++++++++++++ src/parse.cpp | 2 +- src/task.h | 1 + 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bfdcfd9d5..da21de7be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,9 @@ represents a feature release, and the Z represents a patch. (thanks to Vincent Fleuranceau) + Task now allows mixed case attribute names (pri:, PRI:, Pri: ...) and commands (add, ADD, Add ...) (thanks to Vincent Fleuranceau) + + Task now supports a default project and priority for new tasks, via + the new "default.project" and "default.priority" configuration variables + (thanks to Vincent Fleuranceau) ------ old releases ------------------------------ diff --git a/html/config.html b/html/config.html index 609e36d75..c579838f5 100644 --- a/html/config.html +++ b/html/config.html @@ -248,6 +248,16 @@

Colors any task where the description contains X.
+ +
default.project
+
+ Provides a default project name for the "task add ..." command. +
+ +
default.priority
+
+ Provides a default priority for the "task add ..." command. +

diff --git a/html/task.html b/html/task.html index 12882c036..b991cb6ed 100644 --- a/html/task.html +++ b/html/task.html @@ -100,6 +100,9 @@ color is disabled (thanks to Vincent Fleuranceau).
  • Task now allows mixed case attribute names (pri:, PRI:, Pri: ...) and commands (add, ADD, Add ...) (thanks to Vincent Fleuranceau). +
  • Task now supports a default project and priority for new tasks, via + the new "default.project" and "default.priority" configuration variables + (thanks to Vincent Fleuranceau).

    diff --git a/src/command.cpp b/src/command.cpp index 91a3053f2..a9117964d 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -66,6 +66,20 @@ void handleAdd (const TDB& tdb, T& task, Config& conf) task.setAttribute ("mask", ""); } +/**/ + // Override with default.project, if not specified. + if (task.getAttribute ("project") == "") + task.setAttribute ("project", conf.get ("default.project", "")); + + // Override with default.priority, if not specified. + if (task.getAttribute ("priority") == "") + { + std::string defaultPriority = conf.get ("default.priority", ""); + if (validPriority (defaultPriority)) + task.setAttribute ("priority", defaultPriority); + } +/**/ + if (task.getDescription () == "") throw std::string ("Cannot add a blank task."); diff --git a/src/parse.cpp b/src/parse.cpp index 4dcd3bdbd..98c376fe2 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -208,7 +208,7 @@ bool validDate (std::string& date, Config& conf) } //////////////////////////////////////////////////////////////////////////////// -static bool validPriority (const std::string& input) +bool validPriority (const std::string& input) { if (input != "H" && input != "M" && diff --git a/src/task.h b/src/task.h index ced6b3c18..7b732f423 100644 --- a/src/task.h +++ b/src/task.h @@ -55,6 +55,7 @@ for (typeof (c) *foreach_p = & (c); \ // parse.cpp void parse (std::vector &, std::string&, T&, Config&); +bool validPriority (const std::string&); bool validDate (std::string&, Config&); // task.cpp From df215f228dfef865693e63905ecf1955f5765c11 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 12 Sep 2008 12:48:53 -0400 Subject: [PATCH 08/12] - Task supports improved word-wrapping to the terminal width. --- ChangeLog | 1 + html/task.html | 1 + src/command.cpp | 32 ++++++++++++++++++++++---------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index da21de7be..566dde826 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,7 @@ represents a feature release, and the Z represents a patch. + Task now supports a default project and priority for new tasks, via the new "default.project" and "default.priority" configuration variables (thanks to Vincent Fleuranceau) + + Task supports improved word-wrapping to the terminal width ------ old releases ------------------------------ diff --git a/html/task.html b/html/task.html index b991cb6ed..c1c3e76f6 100644 --- a/html/task.html +++ b/html/task.html @@ -103,6 +103,7 @@

  • Task now supports a default project and priority for new tasks, via the new "default.project" and "default.priority" configuration variables (thanks to Vincent Fleuranceau). +
  • Task supports improved word-wrapping to the terminal width.

    diff --git a/src/command.cpp b/src/command.cpp index a9117964d..51d5f7f37 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -274,6 +274,26 @@ void handleVersion (Config& conf) } #endif + // Create a table for the disclaimer. + Table disclaimer; + disclaimer.setTableWidth (width); + disclaimer.addColumn (" "); + disclaimer.setColumnWidth (0, Table::flexible); + disclaimer.setColumnJustification (0, Table::left); + disclaimer.addCell (disclaimer.addRow (), 0, + "Task comes with ABSOLUTELY NO WARRANTY; for details read the COPYING file " + "included. This is free software, and you are welcome to redistribute it " + "under certain conditions; again, see the COPYING file for details."); + + // Create a table for the URL. + Table link; + link.setTableWidth (width); + link.addColumn (" "); + link.setColumnWidth (0, Table::flexible); + link.setColumnJustification (0, Table::left); + link.addCell (link.addRow (), 0, + "See http://www.beckingham.net/task.html for the latest releases and a full tutorial."); + // Create a table for output. Table table; table.setTableWidth (width); @@ -312,18 +332,10 @@ void handleVersion (Config& conf) << " " << VERSION << std::endl - << std::endl - << "Task comes with ABSOLUTELY NO WARRANTY; for details read the COPYING file" - << std::endl - << "included. This is free software, and you are welcome to redistribute it" - << std::endl - << "under certain conditions; again, see the COPYING file for details." - << std::endl + << disclaimer.render () << std::endl << table.render () - << std::endl - << "See http://www.beckingham.net/task.html for the latest releases and a full tutorial." - << std::endl + << link.render () << std::endl; // Verify installation. This is mentioned in the documentation as the way to From e9a71b7db926c614c4e27d8f67744a186bcd5404 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 12 Sep 2008 15:25:38 -0400 Subject: [PATCH 09/12] - Fixed bug where relative dates in filters (task list due:eom, task list due:tomorrow, task list due:23rd ...) are now properly supported. --- ChangeLog | 2 ++ html/task.html | 3 +++ src/Date.cpp | 21 +++++++++++++++++---- src/report.cpp | 2 ++ src/tests/in | 15 +++++++++++++++ src/tests/out | 15 +++++++++++++++ 6 files changed, 54 insertions(+), 4 deletions(-) create mode 100755 src/tests/in create mode 100755 src/tests/out diff --git a/ChangeLog b/ChangeLog index 566dde826..2b73ee2a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,8 @@ represents a feature release, and the Z represents a patch. the new "default.project" and "default.priority" configuration variables (thanks to Vincent Fleuranceau) + Task supports improved word-wrapping to the terminal width + + Bug: Now properly supports relative dates in filters (task list due:eom, + task list due:tomorrow, task list due:23rd ...) ------ old releases ------------------------------ diff --git a/html/task.html b/html/task.html index c1c3e76f6..feca286da 100644 --- a/html/task.html +++ b/html/task.html @@ -104,6 +104,9 @@ the new "default.project" and "default.priority" configuration variables (thanks to Vincent Fleuranceau).

  • Task supports improved word-wrapping to the terminal width. +
  • Fixed bug so that relative dates in filters (task list due:eom, + task list due:tomorrow, task list due:23rd ...) are now properly + supported.

    diff --git a/src/Date.cpp b/src/Date.cpp index f7378bbb3..67ac7e7c7 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -543,22 +543,35 @@ bool Date::isRelativeDate (const std::string& input) else today += (dow - today.dayOfWeek ()) * 86400; - mT = today.mT; + int m, d, y; + today.toMDY (m, d, y); + Date then (m, d, y); + + mT = then.mT; return true; } else if (found == "today") { - mT = today.mT; + Date then (today.month (), + today.day (), + today.year ()); + mT = then.mT; return true; } else if (found == "tomorrow") { - mT = today.mT + 86400; + Date then (today.month (), + today.day (), + today.year ()); + mT = then.mT + 86400; return true; } else if (found == "yesterday") { - mT = today.mT - 86400; + Date then (today.month (), + today.day (), + today.year ()); + mT = then.mT - 86400; return true; } else if (found == "eom") diff --git a/src/report.cpp b/src/report.cpp index c3c928b28..c82abeaac 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -79,6 +79,7 @@ void filter (std::vector& all, T& task) // Apply attribute filter. matches = 0; foreach (a, attrList) + { if (a->first == "project") { if (a->second.length () <= refTask.getAttribute (a->first).length ()) @@ -87,6 +88,7 @@ void filter (std::vector& all, T& task) } else if (a->second == refTask.getAttribute (a->first)) ++matches; + } if (matches == attrList.size ()) { diff --git a/src/tests/in b/src/tests/in new file mode 100755 index 000000000..761c1f877 --- /dev/null +++ b/src/tests/in @@ -0,0 +1,15 @@ +./task add monday due:monday +./task add tuesday due:tuesday +./task add wednesday due:wednesday +./task add thursday due:thursday +./task add friday due:friday +./task add saturday due:saturday +./task add sunday due:sunday +./task add yesterday due:yesterday +./task add today due:today +./task add tomorrow due:tomorrow +./task add eow due:eow +./task add eom due:eom +./task add eoy due:eoy +./task add 21st due:21st + diff --git a/src/tests/out b/src/tests/out new file mode 100755 index 000000000..c0b81f3b4 --- /dev/null +++ b/src/tests/out @@ -0,0 +1,15 @@ +./task li due:monday +./task li due:tuesday +./task li due:wednesday +./task li due:thursday +./task li due:friday +./task li due:saturday +./task li due:sunday +./task li due:yesterday +./task li due:today +./task li due:tomorrow +./task li due:eow +./task li due:eom +./task li due:eoy +./task li due:21st + From fb87039d8c5f6423e60a6fad3d3958e1a37800db Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 12 Sep 2008 16:07:50 -0400 Subject: [PATCH 10/12] - Task now supports "default.command" configuration variable (for example it could contain "list due:tomorrow") that is the command that is run whenever task is invoked with no arguments. --- AUTHORS | 2 ++ ChangeLog | 3 +++ html/advanced.html | 19 +++++++++++++++++++ html/config.html | 28 ++++++++++++++++++++++++++++ html/task.html | 3 +++ src/task.cpp | 19 ++++++++++++++++--- 6 files changed, 71 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index a90a432e7..90e803dcb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -16,3 +16,5 @@ With thanks to: H. İbrahim Güngör Stas Antons Vincent Fleuranceau + T. Charles Yun + diff --git a/ChangeLog b/ChangeLog index 2b73ee2a7..78b5b5996 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,9 @@ represents a feature release, and the Z represents a patch. the new "default.project" and "default.priority" configuration variables (thanks to Vincent Fleuranceau) + Task supports improved word-wrapping to the terminal width + + Task now supports "default.command" configuration variable (for example + it could contain "list due:tomorrow") that is the command that is run + whenever task is invoked with no arguments. + Bug: Now properly supports relative dates in filters (task list due:eom, task list due:tomorrow, task list due:23rd ...) diff --git a/html/advanced.html b/html/advanced.html index feed82b65..3208f2671 100644 --- a/html/advanced.html +++ b/html/advanced.html @@ -43,6 +43,25 @@ lists all these commands.

    +

    + However, if the following configuration variable is specified: +

    + +
    default.command=list pri:H
    + +

    + Then this command will be run whenever task is run without arguments. + This means that your most common task command can be run simply + with the command: +

    + +
    % task
    +[task list project:foo]
    +
    +ID Project Pri Description
    + 1 foo     H   Design the thing
    + 2 foo         Build the thing
    + % task projects

    This report generates a list of all the different projects that you diff --git a/html/config.html b/html/config.html index c579838f5..251766af1 100644 --- a/html/config.html +++ b/html/config.html @@ -258,6 +258,34 @@

    Provides a default priority for the "task add ..." command.
    + +
    default.command
    +
    +

    + Provides a default command that is run every time task is + invoked with no arguments. For example, if set to: +

    + +
    default.command=list project:foo
    + +

    + Then task will run the "list project:foo" command if no + command is specified. This means that by merely typing: +

    + +
    % task
    +[task list project:foo]
    +
    +ID Project Pri Description
    + 1 foo     H   Design the thing
    + 2 foo         Build the thing
    + +

    + Note that the value of this variable is simply the command + line that you would ordinarily type, but without the + preceding "task" program name. +

    +

    diff --git a/html/task.html b/html/task.html index feca286da..6ada83b3c 100644 --- a/html/task.html +++ b/html/task.html @@ -104,6 +104,9 @@ the new "default.project" and "default.priority" configuration variables (thanks to Vincent Fleuranceau).
  • Task supports improved word-wrapping to the terminal width. +
  • Task now supports "default.command" configuration variable (for example + it could contain "list due:tomorrow") which is the command that is run + whenever task is invoked with no arguments.
  • Fixed bug so that relative dates in filters (task list due:eom, task list due:tomorrow, task list due:23rd ...) are now properly supported. diff --git a/src/task.cpp b/src/task.cpp index cc192e18e..9fbcf84f7 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -299,10 +299,23 @@ int main (int argc, char** argv) if (conf.get ("command.logging") == "on") tdb.logCommand (argc, argv); - // Parse the command line. + // If argc == 1 and the default.command configuration variable is set, + // then use that, otherwise stick with argc/argv. std::vector args; - for (int i = 1; i < argc; ++i) - args.push_back (argv[i]); + std::string defaultCommand = conf.get ("default.command"); + if (argc == 1 && defaultCommand != "") + { + // Stuff the command line. + split (args, defaultCommand, ' '); + std::cout << "[task " << defaultCommand << "]" << std::endl; + } + else + { + // Parse the command line. + for (int i = 1; i < argc; ++i) + args.push_back (argv[i]); + } + std::string command; T task; parse (args, command, task, conf); From ec15dc93425ff573c1a8b1733787567105af9073 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 12 Sep 2008 16:22:51 -0400 Subject: [PATCH 11/12] - Added "#include " to task.cpp to ensure clean build under GCC 4.3 --- AUTHORS | 2 +- ChangeLog | 2 ++ html/task.html | 4 ++++ src/task.cpp | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 90e803dcb..d045cad9b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,6 +4,7 @@ Principal Author: Contributing Authors: Damian Glenny Andy Lester + H. İbrahim Güngör With thanks to: Eugene Kramer @@ -13,7 +14,6 @@ With thanks to: Thomas Engel Nishiishii galvanizd - H. İbrahim Güngör Stas Antons Vincent Fleuranceau T. Charles Yun diff --git a/ChangeLog b/ChangeLog index 78b5b5996..48dc2987c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,8 @@ represents a feature release, and the Z represents a patch. whenever task is invoked with no arguments. + Bug: Now properly supports relative dates in filters (task list due:eom, task list due:tomorrow, task list due:23rd ...) + + Bug: Source now properly includes in order to build clean + using gcc 4.3. ------ old releases ------------------------------ diff --git a/html/task.html b/html/task.html index 6ada83b3c..c33898471 100644 --- a/html/task.html +++ b/html/task.html @@ -81,6 +81,7 @@ Mac OS X 10.5 (Leopard) Intel-only: task-1.4.2.pkg +

    New in version 1.4.2 (9/12/2008)

    @@ -110,6 +112,8 @@
  • Fixed bug so that relative dates in filters (task list due:eom, task list due:tomorrow, task list due:23rd ...) are now properly supported. +
  • Fixed bug so that source now properly includes <string.h> in + order to build clean using gcc 4.3.

    diff --git a/src/task.cpp b/src/task.cpp index 9fbcf84f7..29951dee3 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include From e35dcd0e4264722236b71fabef62214cd6e1cb6e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 12 Sep 2008 16:46:22 -0400 Subject: [PATCH 12/12] - Minor doc edit. --- ChangeLog | 2 +- html/task.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48dc2987c..f924b0d61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,7 @@ represents a feature release, and the Z represents a patch. ------ current release --------------------------- -1.4.2 (9/12/2008) +1.4.2 (9/13/2008) + "task undo" can now retract a "task done" command, provided no reports have been run (and therefore TDB::gc run) + Task now correctly sorts on entire strings, instead of just the first diff --git a/html/task.html b/html/task.html index c33898471..cec9f6ae7 100644 --- a/html/task.html +++ b/html/task.html @@ -92,7 +92,7 @@ --> -

    New in version 1.4.2 (9/12/2008)

    +

    New in version 1.4.2 (9/13/2008)