Fixed misleading task count at bottom of "info" report.
Added support for a shadow file that contains a plain text task report,
with the "shadow.file" and "shadow.command" configuration variables.
The shadow file is automatically updated whenever the task database
changes. Useful for integrating with "Samurize".
+
Task now displays a message whenever a shadow file is updated, if the
+ "shadow.notify" configuration variable is set "on".
+
Fixed bug whereby adding a task with a \n, \r or \f dit not fail properly.
diff --git a/src/Config.cpp b/src/Config.cpp
index 6fe00db3a..571b25c10 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -131,6 +131,10 @@ void Config::createDefault (const std::string& home)
fprintf (out, "#color.tag.bug=yellow\n");
fprintf (out, "#color.project.home=on_green\n");
fprintf (out, "#color.keyword.car=on_blue\n");
+ fprintf (out, "#shadow.file=%s/shadow.txt\n", dataDir.c_str ());
+ fprintf (out, "#shadow.command=list\n");
+ fprintf (out, "#shadow.notify=on\n");
+ fprintf (out, "#default.command=list\n");
fclose (out);
diff --git a/src/command.cpp b/src/command.cpp
index b696a8f93..5742a3797 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -82,7 +82,7 @@ void handleAdd (TDB& tdb, T& task, Config& conf)
// Disallow blank descriptions.
if (task.getDescription () == "")
- throw std::string ("Cannot add a blank task.");
+ throw std::string ("Cannot add a task that is blank, or contains or characters.");
if (!tdb.addT (task))
throw std::string ("Could not create new task.");
diff --git a/src/parse.cpp b/src/parse.cpp
index c468a822c..36c4e349c 100644
--- a/src/parse.cpp
+++ b/src/parse.cpp
@@ -284,10 +284,21 @@ static bool validTag (const std::string& input)
////////////////////////////////////////////////////////////////////////////////
static bool validDescription (const std::string& input)
{
- if (input.length () > 0)
+/*
+ if (input.length () > 0 &&
+ input.find ("\r") == std::string::npos &&
+ input.find ("\f") == std::string::npos &&
+ input.find ("\n") == std::string::npos)
return true;
return false;
+*/
+ if (input.length () == 0) return false;
+ if (input.find ("\r") != std::string::npos) return false;
+ if (input.find ("\f") != std::string::npos) return false;
+ if (input.find ("\n") != std::string::npos) return false;
+
+ return true;
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/task.cpp b/src/task.cpp
index 40a4a15a0..a0a097c59 100644
--- a/src/task.cpp
+++ b/src/task.cpp
@@ -679,13 +679,10 @@ void updateRecurrenceMask (
// Using gTdb and gConf, generate a report.
void onChangeCallback ()
{
- std::cout << "--- callback" << std::endl;
try
{
if (gConf && gTdb)
{
- std::cout << "--- valid globals" << std::endl;
-
// Determine if shadow file is enabled.
std::string shadowFile = expandPath (gConf->get ("shadow.file"));
if (shadowFile != "")
@@ -695,8 +692,6 @@ void onChangeCallback ()
gConf->set ("curses", "off");
gConf->set ("color", "off");
- std::cout << "--- shadowFile " << shadowFile<< std::endl;
-
// Run report. Use shadow.command, using default.command as a fallback
// with "list" as a default.
std::string command = gConf->get ("shadow.command",
@@ -714,13 +709,15 @@ void onChangeCallback ()
else
throw std::string ("Could not write file '") + shadowFile + "'";
- std::cout << "--- Complete " << std::endl;
-
gConf->set ("curses", oldCurses);
gConf->set ("color", oldColor);
}
else
throw std::string ("No specified shadow file '") + shadowFile + "'.";
+
+ // Optionally display a notification that the shadow file was updated.
+ if (gConf->get (std::string ("shadow.notify"), false))
+ std::cout << "[Shadow file '" << shadowFile << "' updated]" << std::endl;
}
else
throw std::string ("Internal error (TDB/Config).");
From b0e18de1b6c055587f495aebf3504ddc58f46db4 Mon Sep 17 00:00:00 2001
From: Paul Beckingham
Date: Sat, 25 Oct 2008 02:09:31 -0400
Subject: [PATCH 06/12] - Fixed bug where the onChangeCallback was being called
twice for "task list" after "task do xx".
---
src/TDB.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/TDB.cpp b/src/TDB.cpp
index 4e2c985f2..54f9c31c6 100644
--- a/src/TDB.cpp
+++ b/src/TDB.cpp
@@ -414,7 +414,8 @@ bool TDB::writeCompleted (const T& t)
fputs (t.compose ().c_str (), out);
fclose (out);
- dbChanged ();
+ // Note: No call to dbChanged here because this call never occurs by itself.
+ // It is always accompanied by an overwritePending call.
return true;
}
From 82c0fea708ee27380d4ca6ed81e0019467179b20 Mon Sep 17 00:00:00 2001
From: Paul Beckingham
Date: Sat, 1 Nov 2008 16:14:15 -0400
Subject: [PATCH 07/12] - Remove debugging code.
---
src/task.cpp | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/task.cpp b/src/task.cpp
index 9dbdb2b79..daabfc9db 100644
--- a/src/task.cpp
+++ b/src/task.cpp
@@ -679,13 +679,10 @@ void updateRecurrenceMask (
// Using gTdb and gConf, generate a report.
void onChangeCallback ()
{
- std::cout << "--- callback" << std::endl;
try
{
if (gConf && gTdb)
{
- std::cout << "--- valid globals" << std::endl;
-
// Determine if shadow file is enabled.
std::string shadowFile = expandPath (gConf->get ("shadow.file"));
if (shadowFile != "")
@@ -695,8 +692,6 @@ void onChangeCallback ()
gConf->set ("curses", "off");
gConf->set ("color", "off");
- std::cout << "--- shadowFile " << shadowFile<< std::endl;
-
// Run report. Use shadow.command, using default.command as a fallback
// with "list" as a default.
std::string command = gConf->get ("shadow.command",
@@ -714,8 +709,6 @@ void onChangeCallback ()
else
throw std::string ("Could not write file '") + shadowFile + "'";
- std::cout << "--- Complete " << std::endl;
-
gConf->set ("curses", oldCurses);
gConf->set ("color", oldColor);
}
From 2cae1df42f7bc72fa1150baabd1152faf2ee4d42 Mon Sep 17 00:00:00 2001
From: Paul Beckingham
Date: Sat, 1 Nov 2008 16:31:30 -0400
Subject: [PATCH 08/12] - Merged 1.4.3 to master
---
AUTHORS | 1 +
ChangeLog | 9 +
NEWS | 2 +-
TUTORIAL | 6 +
announcement.txt | 36 ----
configure.ac | 4 +-
html/30second.html | 2 +-
html/advanced.html | 20 ++-
html/color.html | 2 +-
html/config.html | 38 +++-
html/date.html | 2 +-
html/filter.html | 92 ++++++++++
html/recur.html | 2 +-
html/setup.html | 2 +-
html/shadow.html | 98 ++++++++++
html/shell.html | 2 +-
html/simple.html | 2 +-
html/task.html | 22 +--
html/usage.html | 2 +-
html/versions.html | 6 +
src/.gitignore | 1 -
src/TDB.cpp | 27 ++-
src/TDB.h | 10 +-
src/command.cpp | 277 ++++++++++++++++-------------
src/report.cpp | 433 +++++++++++++++++++++++++++++----------------
src/task.cpp | 231 +++++++++++++++++-------
src/task.h | 52 +++---
27 files changed, 950 insertions(+), 431 deletions(-)
create mode 100644 TUTORIAL
delete mode 100644 announcement.txt
create mode 100644 html/filter.html
create mode 100644 html/shadow.html
diff --git a/AUTHORS b/AUTHORS
index d045cad9b..027de8b31 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -17,4 +17,5 @@ With thanks to:
Stas Antons
Vincent Fleuranceau
T. Charles Yun
+ ArchiMark
diff --git a/ChangeLog b/ChangeLog
index c9f0cdaab..c2b641218 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,15 @@
------ old releases ------------------------------
+1.4.3 (10/9/2008)
+ + Fixed misleading task count at bottom on "info" report.
+ + Added support for a shadow file that contains a plain text task report,
+ with the "shadow.file" and "shadow.command" configuration variables.
+ The shadow file is automatically updated whenever the task database
+ changes. Useful for integrating with "Samurize".
+
+------ old releases ------------------------------
+
1.4.2 (9/18/2008)
+ "task undo" can now retract a "task done" command, provided no reports
have been run (and therefore TDB::gc run)
diff --git a/NEWS b/NEWS
index 7698ef623..e936a4cb7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-Welcome to Task 1.5.0.
+Welcome to Task 1.4.3.
Task has been built and tested on the following configurations:
diff --git a/TUTORIAL b/TUTORIAL
new file mode 100644
index 000000000..e389b623a
--- /dev/null
+++ b/TUTORIAL
@@ -0,0 +1,6 @@
+
+This TUTORIAL file has been deprecated. It is superseded by a richer and more
+extensive online version that can be found at:
+
+ http://www.beckingham.net/task.html
+
diff --git a/announcement.txt b/announcement.txt
deleted file mode 100644
index 037106408..000000000
--- a/announcement.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-Some considerable time ago - longer than I had hoped - I demonstrated an
-alternate implementation of the todo script, called task, in the form of a
-YouTube movie:
-
- http://www.youtube.com/watch?v=l68LCl6BYvs
-
-A lot has happened since then, and the task program has been slowly improving
-thanks to feedback from some early testers, and continuous use by me. Today,
-I have uploaded a new movie:
-
- http://www.youtube.com/watch?v=D2Kn4DMOVSw
-
-This movie includes most of the changes and improvements to task, but behind
-the scenes are the biggest changes. There was a rewrite of the underlying
-storage mechanism yielding a clean API for the front end, and the code was
-reviewed for portability and converted to use GNU autoconf/automake.
-
-Task has been released under GPL, and so far has been tested on:
-
- Max OS X 10.4 (Tiger)
- Max OS X 10.5 (Leopard)
- Fedora 8
- Fedora 9
- Ubuntu 8 (Hardy Heron)
- Solaris 10
-
-Task has been making me more organized and productive for some time now.
-Perhaps some of you might find it useful, and I welcome feedback of all kinds.
-
-You can find the task source code at:
-
- http://www.beckingham.net/task-1.0.0.tar.gz
-
-Thank you.
-Paul Beckingham
-
diff --git a/configure.ac b/configure.ac
index e89a1aa53..0c1c977b3 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.3, bugs@beckingham.net)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/task.cpp])
AC_CONFIG_HEADER([auto.h])
@@ -19,7 +19,7 @@ AC_CHECK_LIB(ncurses,endwin)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h sys/file.h sys/stat.h sys/time.h unistd.h])
-AC_CHECK_HEADERS([string vector map])
+AC_CHECK_HEADERS([sstream string vector map])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
diff --git a/html/30second.html b/html/30second.html
index f1450c650..227b0bbf2 100644
--- a/html/30second.html
+++ b/html/30second.html
@@ -1,7 +1,7 @@
- Task 1.4.1
+ 30-Second Tutorial
diff --git a/html/advanced.html b/html/advanced.html
index 07f293754..97a344cdb 100644
--- a/html/advanced.html
+++ b/html/advanced.html
@@ -1,7 +1,7 @@
- Task 1.4.1
+ Advanced Usage
@@ -313,6 +313,24 @@ ID Project Pri Description
This command displays all the colors that task supports.
+ % task usage
+
+ If logging has been enabled by the "command.logging=on" directive
+ in the .taskrc file, then task will record every command that is
+ run. When this command is run, task will display a count of how
+ many times each command was used.
+
+
+
+
+ This command is for the purpose of seeing whether command are
+ actually used.
+
+
+
+ This command is deprecated, and will be removed in task 1.5.0
+
+
% task version
This can be used to show the version number of task, and to display
diff --git a/html/color.html b/html/color.html
index 72c70772b..f88357e0c 100644
--- a/html/color.html
+++ b/html/color.html
@@ -1,7 +1,7 @@
- Task 1.4.1
+ Color Usage
diff --git a/html/config.html b/html/config.html
index 37cd127b8..144df2498 100644
--- a/html/config.html
+++ b/html/config.html
@@ -1,7 +1,7 @@
- Task 1.4.1
+ Task Configuration
@@ -279,6 +279,42 @@ ID Project Pri Description
preceding "task" program name.
+
+
shadow.file
+
+
+ If specified, designates a file path that will be autoamtically
+ written to by task, whenever the task database changes. In other
+ words, it is automatically kept up to date.
+
+
+
+ The shadow.command configuration variable is used to determine
+ which report is written to the shadow file. There is no color
+ used in the shadow file.
+
+
+
+ This feature can be useful in maintaining a current file for
+ use by the "Samurize" program.
+
+
+
+
shadow.command
+
+
+ This is the command that is run to maintain the shadow file,
+ determined by the shadow.file configuration variable. The
+ format is identical to that of default.command - please see
+ the documentation for default.command.
+
+
+
+ If this command is not specified, task will use the default.command
+ value instead. If that is not specified, the command "list" is used.
+
Removed "usage" command, and support for "command.logging" configuration
- variable.
+
Fixed misleading task count at bottom of "info" report.
+
Added support for a shadow file that contains a plain text task report,
+ with the "shadow.file" and "shadow.command" configuration variables.
+ The shadow file is automatically updated whenever the task database
+ changes. Useful for integrating with "Samurize".
- If logging has been enabled by the "command.logging=on" directive
- in the .taskrc file, then task will record every command that is
- run. When this command is run, task will display a count of how
- many times each command was used.
-
-
-
-
- This command is for the purpose of seeing whether command are
- actually used.
-
-
-
- This command is deprecated, and will be removed in task 1.5.0
-
-
% task version
This can be used to show the version number of task, and to display
diff --git a/src/report.cpp b/src/report.cpp
index 8d3339c58..37d488dca 100644
--- a/src/report.cpp
+++ b/src/report.cpp
@@ -1628,85 +1628,6 @@ std::string handleReportGHistory (TDB& tdb, T& task, Config& conf)
return out.str ();
}
-////////////////////////////////////////////////////////////////////////////////
-// A summary of the command usage. Not useful to users, but used to display
-// usage statistics for feedback.
-//
-// 2006-12-04 19:59:43 "task list"
-//
-std::string handleReportUsage (const TDB& tdb, T& task, Config& conf)
-{
- std::stringstream out;
-
- if (conf.get ("command.logging") == "on")
- {
- std::map usage;
- std::vector all;
- tdb.logRead (all);
- for (unsigned int i = 0; i < all.size (); ++i)
- {
- // 0123456789012345678901
- // v 21
- // 2006-12-04 19:59:43 "task list"
- std::string command = all[i].substr (21, all[i].length () - 22);
-
- // Parse as a command line.
- std::vector args;
- split (args, command, " ");
-
- try
- {
- T task;
- std::string commandName;
- parse (args, commandName, task, conf);
-
- usage[commandName]++;
- }
-
- // Deliberately ignore errors from parsing the command log, as there may
- // be commands from a prior version of task in there, which were
- // abbreviated, and are now ambiguous.
- catch (...) {}
- }
-
- // Now render the table.
- Table table;
- table.addColumn ("Command");
- table.addColumn ("Frequency");
-
- if (conf.get ("color", true))
- {
- table.setColumnUnderline (0);
- table.setColumnUnderline (1);
- }
- else
- table.setTableDashedUnderline ();
-
- table.setColumnJustification (1, Table::right);
- table.sortOn (1, Table::descendingNumeric);
- table.setDateFormat (conf.get ("dateformat", "m/d/Y"));
-
- foreach (i, usage)
- {
- int row = table.addRow ();
- table.addCell (row, 0, (i->first == "" ? "(modify)" : i->first));
- table.addCell (row, 1, i->second);
- }
-
- if (table.rowCount ())
- out << optionalBlankLine (conf)
- << table.render ()
- << std::endl;
- else
- out << "No usage." << std::endl;
- }
- else
- out << "Command logging is not enabled, so no history has been kept."
- << std::endl;
-
- return out.str ();
-}
-
////////////////////////////////////////////////////////////////////////////////
std::string renderMonths (
int firstMonth,
diff --git a/src/task.cpp b/src/task.cpp
index 6bf8b06bf..bb7aff74f 100644
--- a/src/task.cpp
+++ b/src/task.cpp
@@ -300,10 +300,6 @@ int main (int argc, char** argv)
std::string dataLocation = expandPath (conf.get ("data.location"));
tdb.dataDirectory (dataLocation);
- // Log commands, if desired.
- if (conf.get ("command.logging") == "on")
- tdb.logCommand (argc, argv);
-
// Set up TDB callback.
std::string shadowFile = expandPath (conf.get ("shadow.file"));
if (shadowFile != "")
@@ -789,7 +785,6 @@ std::string runTaskCommand (
else if (command == "oldest") out = handleReportOldest (tdb, task, conf);
else if (command == "newest") out = handleReportNewest (tdb, task, conf);
else if (command == "stats") out = handleReportStats (tdb, task, conf);
- else if (command == "usage") out = handleReportUsage (tdb, task, conf);
else if (command == "" && task.getId ()) handleModify (tdb, task, conf);
else if (command == "help") longUsage (conf);
else shortUsage (conf);
diff --git a/src/task.h b/src/task.h
index 8bfb92f0c..d8bab55ca 100644
--- a/src/task.h
+++ b/src/task.h
@@ -95,7 +95,6 @@ std::string handleReportSummary (TDB&, T&, Config&);
std::string handleReportNext (TDB&, T&, Config&);
std::string handleReportHistory (TDB&, T&, Config&);
std::string handleReportGHistory (TDB&, T&, Config&);
-std::string handleReportUsage (const TDB&, T&, Config&);
std::string handleReportCalendar (TDB&, T&, Config&);
std::string handleReportActive (TDB&, T&, Config&);
std::string handleReportOverdue (TDB&, T&, Config&);
From 612a183776a8591f997d7a5885f8512b159a02fd Mon Sep 17 00:00:00 2001
From: Paul Beckingham
Date: Sun, 2 Nov 2008 21:23:34 -0500
Subject: [PATCH 11/12] - Major documentation update - New filter page - New
shadow file page
---
ChangeLog | 4 +-
html/30second.html | 1 +
html/advanced.html | 1 +
html/color.html | 1 +
html/config.html | 1 +
html/date.html | 1 +
html/filter.html | 41 +++++++++++++++
html/links.html | 105 ++++++++++++++++++++++++++++++++++----
html/recur.html | 1 +
html/setup.html | 1 +
html/shadow.html | 30 ++++++++++-
html/shell.html | 1 +
html/simple.html | 1 +
html/task.html | 12 +++--
html/troubleshooting.html | 1 +
html/usage.html | 1 +
html/versions.html | 1 +
17 files changed, 190 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ac59f79f0..93dc5afe8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,15 @@
------ current release ---------------------------
-1.4.3 (10/9/2008)
+1.4.3 (11/1/2008)
+ Fixed misleading task count at bottom on "info" report.
+ Added support for a shadow file that contains a plain text task report,
with the "shadow.file" and "shadow.command" configuration variables.
The shadow file is automatically updated whenever the task database
changes. Useful for integrating with "Samurize".
+ Removed "task usage" command.
+ + Added documentation for Shadow files.
+ + Added documentation for task filters.
------ old releases ------------------------------
diff --git a/html/30second.html b/html/30second.html
index 227b0bbf2..6cde1c6c2 100644
--- a/html/30second.html
+++ b/html/30second.html
@@ -25,6 +25,7 @@
Date HandlingTroubleshootingOld Versions
+ Task on the Web
+ A task filter is a means of reducing a task report to a
+ subset that may consist of all tasks that have a specific
+ project, priority, tag, or part of the description.
+
+
+
+ A task filter consists of additional command line options,
+ that are specified in the same way as when a task is added.
+
+
+
+ All task reports can make use of filters.
+
+
+
+ For example, the report:
+
+
+
% task list
+
+
+ Lists all tasks.
+
+
+
% task list the
+
+
+ Lists only tasks with "the" in the task description.
+
+
+
% task list project:Home priority:H
+
+
+ Lists only tasks with both the "Home" project and "H" priority.
+
+ This YouTube movie was made to illustrate some of the features of the task
+ program, back when task 1.0.0 was released. While task has grown
+ significantly since then, the commands shown are still valid. It will
+ soon be time for a new movie!
+
+
+ This movie has a voice-over that explains what is going on.
+
+
+ For a higher-quality version, download the whole
+ movie file (10MB).
+
+ This original YouTube task movie was made to illustrate the features of the
+ then-unreleased task program. The idea was to get some feedback and see
+ whether anyone was interested in a new implementation of todo.sh, that added
+ features that are not easily possible with a shell implementation.
+
+
+ This movie has no voice-over, and you may notice that it exactly duplicates
+ the commands used in the original todo.sh movie (below). That is, until it
+ deviates because of new task commands.
+
+ by Gina Trapani. The website that introduced me to the power and
+ simplicity of the original todo.sh program. Contains useful links
+ and resources - take a look!
+
+ A shadow file is a text file containing a copy of a task
+ report. It is automatically maintained by task whenever
+ something changes in the task database.
+
+
+ This means there is always a current version of the task
+ report kept in a text file. Products such as
+ Samurize,
+ MkConsole,
+ or
+ GeekTool
+ can display this file on the computer desktop, so that it
+ is readily visible.
+
+
+ To use a shadow file, edit your .taskrc configuration file,
+ and add two entries as shown:
+
+ In this example the shadow file contains a report equivalent
+ to running "task list pri:H".
+
-
+
+ You can use any task command that generates a report, and of
+ course, you can specify any file name, provided the directory
+ it resides in already exists.
Fixed misleading task count at bottom of "info" report.
Added support for a shadow file that contains a plain text task report,
with the "shadow.file" and "shadow.command" configuration variables.
The shadow file is automatically updated whenever the task database
changes. Useful for integrating with "Samurize".
+
Removed "task usage" command.
+
Added documentation for Shadow files.
+
Added documentation for task filters.
diff --git a/html/troubleshooting.html b/html/troubleshooting.html
index d21b59164..5e3147631 100644
--- a/html/troubleshooting.html
+++ b/html/troubleshooting.html
@@ -25,6 +25,7 @@
Date HandlingTroubleshootingOld Versions
+ Task on the Web
From 47ffc0babc8a98f8625cd07b2c696338517ce756 Mon Sep 17 00:00:00 2001
From: Paul Beckingham
Date: Sun, 2 Nov 2008 21:43:10 -0500
Subject: [PATCH 12/12] - Deleted old test file.
---
src/tests/out | 15 ---------------
1 file changed, 15 deletions(-)
delete mode 100755 src/tests/out
diff --git a/src/tests/out b/src/tests/out
deleted file mode 100755
index c0b81f3b4..000000000
--- a/src/tests/out
+++ /dev/null
@@ -1,15 +0,0 @@
-./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
-