Compare commits

..

53 Commits

Author SHA1 Message Date
Paul Beckingham
3a6de7d940 - Corrected Cygwin ncurses documentation
- Added galvanizd to the AUTHOS file for recognition of above tip
2008-06-22 00:14:26 -04:00
Paul Beckingham
994f98b57a - Added new 1.3.1 .deb files from Richard Querin. 2008-06-21 23:28:19 -04:00
Paul Beckingham
44ca388b52 - Updated for 1.3.1 release. 2008-06-21 17:15:14 -04:00
Paul Beckingham
06a85c24ad - Fixed bug so that task now recreates (with permission) any missing ~/.taskrc, and recreates any missing ~/.task 2008-06-21 17:12:04 -04:00
Paul Beckingham
ceaba87ba3 - Fixed bug causing seg faults for Ubuntu users. 2008-06-21 16:38:01 -04:00
Paul Beckingham
61acf6239c - Relocated all html into it's own directory. 2008-06-21 15:33:31 -04:00
Paul Beckingham
8dc8cdeea7 - Updated docs 2008-06-21 15:28:36 -04:00
Paul Beckingham
10ef3013e3 - Rearranged top of main page. 2008-06-21 14:59:01 -04:00
Paul Beckingham
3899f5352f - Added version number in just the right place. 2008-06-21 14:43:20 -04:00
Paul Beckingham
64fbf88f48 - Updated to include 1.3.1 information.
- Modified task.css
2008-06-21 13:41:56 -04:00
Paul Beckingham
2e0964aeb8 Merge branch 'master' into 1.3.1
Conflicts:

	task.html
2008-06-21 13:35:12 -04:00
Paul Beckingham
35d878de96 - Broken out CSS file
- Broken out troubleshooting guide
- Broken out versions info
2008-06-21 12:49:30 -04:00
Paul Beckingham
d771586080 - Converted version to 1.3.1
- Added links in task.html to Richard Querin's blog
- Added link to movie
2008-06-19 23:31:36 -04:00
Paul Beckingham
6673e408a2 - Now uses "defaultwidth" configuration variable for when ncurses support is not available
- Added the new movie to the task.html page
2008-06-19 22:41:09 -04:00
Paul Beckingham
422ad576ea - Added latest bug fix details. 2008-06-19 21:23:15 -04:00
Paul Beckingham
c1a1d13aab - Updated version 1.3.0 to 1.4.0
- Applied "showage" configuration variable to long list
2008-06-19 21:21:21 -04:00
Paul Beckingham
42189ce998 - Added some idea details 2008-06-19 21:01:14 -04:00
Paul Beckingham
43287d7fc9 - Corrected AUTHORS file
- Added new commands to task.html
2008-06-18 01:08:34 -04:00
Paul Beckingham
06f6aaaded - Minor doc updates before 1.3.0 is cut. 2008-06-18 00:45:12 -04:00
Paul Beckingham
0c17986303 - Added "task oldest" command
- Added "task newest" command
2008-06-18 00:41:33 -04:00
Paul Beckingham
feb9959907 - Added new bug fixes to task.html 2008-06-18 00:08:53 -04:00
Paul Beckingham
7409e23ce0 - Displays shorter message when a command is entered incorrectly, and the full usage for "task help". 2008-06-18 00:05:51 -04:00
Paul Beckingham
4572c97c9d - Fixed bug whereby "1 wks" was being improperly pluralized 2008-06-17 23:56:39 -04:00
Paul Beckingham
9bca303113 - Factored out filtering code. 2008-06-17 23:40:37 -04:00
Paul Beckingham
7fb3ab0c3d - Marked bug as fixed. 2008-06-17 23:05:41 -04:00
Paul Beckingham
56037fe3bc - Added latest bug fix. 2008-06-17 23:03:50 -04:00
Paul Beckingham
a2f8ce41cf - Began full command line parser BNF grammar. 2008-06-17 22:54:04 -04:00
Paul Beckingham
598bd3b4ef - Fixed crash bug in Date::toString
- New ideas file.
2008-06-17 22:23:31 -04:00
Paul Beckingham
315a7d69fb - Updated ChangeLog
- Removed AdSense HTML fragment
- Created new ideas.txt file to illustrate usage of proposed features
2008-06-17 22:10:07 -04:00
Paul Beckingham
64fff6c2ff - Added Google Analytics. 2008-06-17 22:03:38 -04:00
Paul Beckingham
969ecd7b5d Merge branch 'master' into 1.3.0 2008-06-17 18:48:23 -04:00
Paul Beckingham
cede865693 - Partial fix to bug - snapshot. 2008-06-17 18:28:24 -04:00
Paul Beckingham
d68395bc51 - Fixed bug whereby if you have more than one task with a due date, 7 days gets added to the entry date of task 2..n 2008-06-17 17:52:12 -04:00
Paul Beckingham
7ec523d5ea - Removed unused std::vector forms of get/set
- Added more defaults to Config::createDefault
2008-06-16 23:37:32 -04:00
Paul Beckingham
08fc906d5f - Updated various documents. 2008-06-16 23:26:22 -04:00
Paul Beckingham
f3e995ef92 Merge branch 'damian' into 1.3.0 2008-06-16 22:26:20 -04:00
Paul Beckingham
a4304c97af - Corrected the "30 days in August" bug.
- Removed odd styling from task.html CSS.
2008-06-16 22:24:49 -04:00
Paul Beckingham
d1ef0d17d5 - Integrated Damian Glenny's changes 2008-06-15 18:38:01 -04:00
Paul Beckingham
c54cb4d6c8 - Bumped version to 1.3.0 2008-06-14 13:55:35 -04:00
Paul Beckingham
c393d47cdf - Corrected bogus .gitignore entry that blocked src/tests/Makefile. 2008-06-13 01:51:51 -04:00
Paul Beckingham
3525b6db2c - Added Bruce Israel for his suggestion of subprojects. 2008-06-13 01:25:38 -04:00
Paul Beckingham
d50efe5e27 - Updated versions 2008-06-13 01:18:53 -04:00
Paul Beckingham
2c0a1ddb3a - Added new feature for 1.2.0 2008-06-13 01:15:49 -04:00
Paul Beckingham
d7ac37783c - Updated documentation to include subproject discussions.
- Added Richard Querin to the AUTHORS file for his contribution of ideas and a .deb package.
2008-06-13 01:02:17 -04:00
Paul Beckingham
03bb50c4ea - Corrected copyright display. 2008-06-13 00:19:54 -04:00
Paul Beckingham
1535010ac9 - "Age" column is now optional for the "list" and "next" reports. 2008-06-13 00:18:28 -04:00
Paul Beckingham
8d90035bbc - Now properly parses dates according to specified date format. 2008-06-12 23:58:58 -04:00
Paul Beckingham
fd7bb9daa9 - Support subprojects. 2008-06-11 02:19:00 -04:00
Paul Beckingham
88b12bc66a - Added caseless keyword comparison to the autocolorization rules. 2008-06-11 01:47:11 -04:00
Paul Beckingham
a8ac82ca22 - Added "What's new in 1.2.0" section. 2008-06-11 01:45:07 -04:00
Paul Beckingham
438f3cb134 - Added caseless comparison when searching keywords in the description. 2008-06-11 01:40:01 -04:00
Paul Beckingham
131693f617 - Fixed bug whereby the "dateformat" configuration variable was being used to display dates, but not parse them. 2008-06-11 01:14:22 -04:00
Paul Beckingham
07d1f63e31 - Bumped version to 1.2.0 2008-06-10 22:59:43 -04:00
29 changed files with 1938 additions and 1012 deletions

13
AUTHORS
View File

@@ -1,8 +1,15 @@
Principal Author:
Paul Beckingham, paul@beckingham.net
With thanks to:
Eugene Kramer
SK
Contributing Authors:
Damian Glenny
With thanks to:
Eugene Kramer
Srijith K
Richard Querin
Bruce Israel
Thomas Engel
Nishiishii
galvanizd

View File

@@ -1,15 +1,55 @@
Version numbers are of the form:
x.y.z
X.Y.Z
where the x represents a major version number, or architecture. The y
represents a feature release, and the z represents a patch.
where the X represents a major version number, or architecture. The Y
represents a feature release, and the Z represents a patch.
1.2.0 (?)
- Command line specification of alternate .taskrc file
------ plans -------------------------------------
- Configurable columns in reports
- Dependencies
- Recurring tasks
1.3.1 (6/21/2008)
+ New configuration variable, "defaultwidth" that determines the width
of tables when ncurses support is not available
+ Bug: "showage" configuration variable should apply to all reports, not
just the ones based on "list"
+ Bug: Fixed segmentation faults on Ubuntu when the "dateformat"
configuration variables was missing. This was a code bug, and should
have affected more platforms
+ Bug: Task now will recreate a missing ~/.taskrc file, OR a missing
~/.task directory
------ reality -----------------------------------
1.3.0 (6/18/2008)
+ "task calendar" now displays multiple months per line, adjustable by the
"monthsperline" configuration variable. Feature added by Damian Glenny
+ "task export" can now filter tasks like the reports
+ Factored out code to filter tasks
+ Displays shorter message when a command is entered incorrectly, and the
full usage for "task help"
+ "task oldest" shows the oldest tasks
+ "task newest" shows the newest tasks
+ Bug: Segmentation fault when no "dateformat" configuration variable
specified
+ Bug: Fixed bug whereby if you have more than one task with a due date, 7
days gets added to the entry date of task 2..n
+ Bug: Fixed bug whereby "1 wks" was being improperly pluralized
1.2.0 (6/13/2008)
+ Bug: "dateformat" configuration variable used to display dates, but
not parse them
+ "task list x" now performs a caseless comparison between "x" and the
description
+ Task sub projects supported
+ "showage" confguration determines whether "Age" column appears on the
"list" and "next" reports
+ Improved TUTORIAL
1.1.0 (6/7/2008)
+ "blanklines" configuration to stop displaying unnecessary white
space and thus work better on small-screen devices
@@ -127,6 +167,7 @@ represents a feature release, and the z represents a patch.
+ File locking
+ retain deleted tasks
+ "task info ID" report showing all metadata
+ File format v2
[Development hiatus while planning for T, TDB API, new features and the future
of the project. Seeded to two testers for feedback, suggestions.]

2
NEWS
View File

@@ -1,4 +1,4 @@
Welcome to Task 1.1.0.
Welcome to Task 1.3.1.
Task has been built and tested on the following configurations:

120
TUTORIAL
View File

@@ -1,4 +1,4 @@
Task program tutorial, for version 1.1.0
Task program tutorial, for version 1.3.1
----------------------------------------
This guide shows how to quickly set up the task program, and become proficient
@@ -21,10 +21,10 @@ Build the task program according to the directions in the INSTALL file. This
transcript illustrates a typical installation:
% ls
task-1.1.0.tar.gz
% gunzip task-1.1.0.tar.gz
% tar xf task-1.1.0.tar
% cd task-1.1.0
task-1.3.1.tar.gz
% gunzip task-1.3.1.tar.gz
% tar xf task-1.3.1.tar
% cd task-1.3.1
% ./configure
...
% make
@@ -67,7 +67,7 @@ interface. Let us take a look at those tasks:
% task ls
ID Project Pri Description
ID Project Pri Description
1 Book plane ticket
2 Rent a tux
3 Reserve a rental car
@@ -97,7 +97,7 @@ a project to these tasks:
% task 4 project:Family
% task ls
ID Project Pri Description
ID Project Pri Description
3 Family Send John a birthday card
2 Wedding Reserve a rental car
1 Wedding Book plane ticket
@@ -107,12 +107,46 @@ attributes changed (project, for example), the ids are prone to change. But the
id numbers will remain valid until the next 'ls' command is run. You should
only use the ids from the most recent 'ls' command. The ids change, because
task is always trying to use small numbers so that it is easy for you to enter
them correctly. Now that projects are assigned, we can look at just the Wedding
project tasks:
them correctly.
Subprojects are supported. If you have a project "Wedding", you can specify
that a task is a subproject "Transport" of "Wedding" by assigning the project
"Wedding.Transport". Let's do this:
% task 2 project:Wedding.Transport
% task ls
ID Project Pri Description
3 Family Send John a birthday card
2 Wedding.Transport Reserve a rental car
1 Wedding Book plane ticket
Task matches the leftmost part of the project when searching, so projects
may be abbreviated:
% task ls project:Wedding.Tra
ID Project Pri Description
2 Wedding.Transport Reserve a rental car
This way of matching projects can be used to see all tasks under the
"Wedding" project and all subprojects:
% task ls project:Wedding
ID Project Pri Description
ID Project Pri Description
2 Wedding.Transport Reserve a rental car
1 Wedding Book plane ticket
Let's reassign 2 back to the "Wedding" project:
% task 2 project:Wedding
Now that projects are assigned, we can look at just the Wedding project tasks:
% task ls project:Wedding
ID Project Pri Description
1 Wedding Book plane ticket
2 Wedding Reserve a rental car
@@ -121,14 +155,14 @@ could also have requested:
% task ls ticket plane
ID Project Pri Description
ID Project Pri Description
1 Wedding Book plane ticket
Now let's prioritize. Priorities can be H, M or L (High, Medium, Low).
% task ls
ID Project Pri Description
ID Project Pri Description
3 Family Send John a birthday card
2 Wedding Reserve a rental car
1 Wedding Book plane ticket
@@ -140,7 +174,7 @@ Now let's prioritize. Priorities can be H, M or L (High, Medium, Low).
% task 3 pri:H
% task ls
ID Project Pri Description
ID Project Pri Description
3 Family H Send John a birthday card
1 Wedding H Book plane ticket
2 Wedding M Reserve a rental car
@@ -161,7 +195,7 @@ command provides more:
% task list
ID Project Pri Due Active Age Description
ID Project Pri Due Active Age Description
3 Family H 4 mins Send John a birthday card
1 Wedding H 5 mins Book plane ticket
2 Wedding M 5 mins Reserve a rental car
@@ -173,7 +207,7 @@ sorted by due date, then priority. Let's add due dates:
% task 1 due:7/31/2008
% task list
ID Project Pri Due Active Age Description
ID Project Pri Due Active Age Description
3 Family H 6/25/2008 6 mins Send John a birthday card
1 Wedding H 7/31/2008 7 mins Book plane ticket
2 Wedding M 7 mins Reserve a rental car
@@ -212,7 +246,7 @@ labels.
% task list
ID Project Pri Due Active Age Description
ID Project Pri Due Active Age Description
3 Family H 6/25/2008 8 mins Send John a birthday card
1 Wedding H 7/31/2008 9 mins Book plane ticket
2 Wedding M 9 mins Reserve a rental car
@@ -224,7 +258,7 @@ labels.
% task list +phone
ID Project Pri Due Active Age Description
ID Project Pri Due Active Age Description
1 Wedding H 7/31/2008 9 mins Book plane ticket
2 Wedding M 9 mins Reserve a rental car
@@ -266,7 +300,7 @@ with no arguments will generate a help message that lists all these commands.
% task summary
Project Remaining Avg age Complete 0% 100%
Project Remaining Avg age Complete 0% 100%
Errands 1 3 days 50% XXXXXXXXXXXXXXXX
Birthdays 3 7 mths 0%
Car 2 2 wks 25% XXXXXXXXX
@@ -316,14 +350,14 @@ with no arguments will generate a help message that lists all these commands.
% task list
ID Project Pri Due Active Age Description
ID Project Pri Due Active Age Description
12 Errand L Remember to deposit check
...
% task start 12
% task list
ID Project Pri Due Active Age Description
ID Project Pri Due Active Age Description
12 Errand L * 3 days Remember to deposit check
...
@@ -345,13 +379,29 @@ with no arguments will generate a help message that lists all these commands.
% task oldest
-------------
Lists the oldest tasks. Shows 10 tasks by default, but can be set via the
"oldest" configuration variable.
% task newest
-------------
Lists the newest tasks. Shows 10 tasks by default, but can be set via the
"newest" configuration variable.
% task history
--------------
This report shows you an overview of how many tasks were added, completed and
deleted, by month. It looks like this:
% task history
% task history
Year Month Added Completed Deleted Net
2008 March 21 16 0 5
@@ -409,14 +459,14 @@ with no arguments will generate a help message that lists all these commands.
% task ls
ID Project Pri Description
ID Project Pri Description
12 Errand L Remember to deposit chekc
...
% task 12 Remember to deposit bonus check
% task ls
ID Project Pri Description
ID Project Pri Description
12 Errand L Remember to deposit bonus check
...
@@ -430,14 +480,14 @@ with no arguments will generate a help message that lists all these commands.
% task ls
ID Project Pri Description
ID Project Pri Description
12 Errand L Remember to deposit chekc
...
% task 12 /chekc/check/
% task ls
ID Project Pri Description
ID Project Pri Description
12 Errand L Remember to deposit check
...
@@ -644,12 +694,28 @@ Configuring Task
Y four-digit year 2008
The string may also contain other characters to act as
spacers, or formatting. Other values could include:
spacers, or formatting. Other values could include
(but are not limited to):
d/m/Y 7/6/2008
YMD 20080607
m-d-y 6-7-08
showage May be "yes" or "no". Determines whether the "Age"
column appears on the "list" and "next" reports.
monthsperline Determines how many months the "task calendar" command
renders across the screen. Defaults to 1.
oldest Determines how many tasks are shown on the "oldest"
report. Defaults to 10.
newest Determines how many tasks are shown on the "newest"
report. Defaults to 10.
defaultwidth The width of tables used when ncurses support is not
available. Defaults to 80.
color May be "on" or "off". Determines whether task uses
color.
@@ -662,7 +728,7 @@ Configuring Task
color.active below) and one optional background color.
color.tagged
For example, the value may be:
bold_red on_bright_yellow
color.tag.X Colors any task that has the tag X.

View File

@@ -1,12 +0,0 @@
<script type="text/javascript"><!--
google_ad_client = "pub-9709799404235424";
/* Task Main */
google_ad_slot = "8660617875";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

View File

@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT(task, 1.1.0, bugs@beckingham.net)
AC_INIT(task, 1.3.1, bugs@beckingham.net)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/task.cpp])
AC_CONFIG_HEADER([auto.h])

68
grammar.txt Normal file
View File

@@ -0,0 +1,68 @@
This is a full BNF grammar for the task command line. It is intended that a
future release of task will incorporate a complete lexer/parser implementing
this grammar.
command:
VERSION
| HELP
| PROJECTS
| TAGS
| SUMMARY
| HISTORY
| NEXT
| CALENDAR
| ACTIVE
| OVERDUE
| STATS
| USAGE
| OLDEST
| NEWEST
| EXPORT <file>
| COLOR
| DELETE <id>
| INFO <id>
| START <id>
| DONE <id>
| ADD [<tags>] [<attrs>] [<desc>]
| LIST [<tags>] [<attrs>] [<desc>]
| LONG [<tags>] [<attrs>] [<desc>]
| LS [<tags>] [<attrs>] [<desc>]
| COMPLETED [<tags>] [<attrs>] [<desc>]
| <id> [<tags>] [<attrs>] [<desc>]
| <id> <substitution>
id:
\d+
| \d{8}-\d{4}-\d{4}-\d{12}
tags:
+<tag>
| -<tag>
tag:
\w+
attrs:
<attr>
| <attr> <attrs>
attr:
<name>:<value>
name:
\w+
value:
.+
substitution:
/ <pattern> / <pattern> /
pattern:
.+
file:
?

126
html/task.css Normal file
View File

@@ -0,0 +1,126 @@
body {
text-align: center;
margin: 0; padding: 1em;
}
#container {
width: 740px;
text-align: left;
margin: 0 auto; padding: 0;
}
#header {
height: 60px;
margin: 0 0 15px; padding: 0;
}
#page {}
#content {
width: 500px;
}
#header a:link,
#header a:visited {
color:#000;
text-decoration: none;
}
#header h1 {
font: bold 400% georgia, serif;
letter-spacing: -1px;
margin: 0;
float: left;
}
#header h2 {
font: normal 12px verdana, arial, sans-serif;
margin: 2.5em 0 0 0.8em;
float: left;
}
#content {}
#content h1,
#content h2,
#content h3,
#content h4,
#content h5 {
font-family: "lucidamac bold", "lucida grande", arial, sans-serif;
letter-spacing: -1px;
}
#content h1 {
font-size: 24px;
}
#content h2 {
font-size: 22px;
border-bottom: 1px dotted #000;
}
#content h3 {
font-size: 20px;
border-bottom: 1px dotted #bbb;
}
#content h4 {
font-size: 18px;
border-bottom: 1px dotted #bbb;
}
#content h5 {
font-size: 18px;
background: #ffd;
border-bottom: 1px dotted #bbb;
}
#content p {
line-height: 15px;
}
#content ul,
#content ol {
}
#content code {
font: normal 12px "bitstream vera sans mono", monaco "lucida console", "courier new", courier, serif;
}
#content pre {
color: #63FF00;
background: #000;
overflow: auto;
font: normal 12px "bitstream vera sans mono", monaco "lucida console", "courier new", courier, serif;
margin: 0.9em 0; padding: 8px;
}
dt {
font: bold 14px "lucida grande", verdana, arial, helvetica, sans-serif;
}
dd {
}
body {
font: normal 12px "lucida grande", verdana, arial, helvetica, sans-serif;
}
.small {
font: normal 10px verdana, arial, sans-serif;
}
.table_h {
background-color: #e0e0e0;
}
.table_d {
background-color: #f7f7f7;
}
input,
textarea { font: normal 12px "bitstream vera sans", verdana, sans-serif; }
abbr { border: none; }
cite { font-style: normal; }
a img { border: none; padding: 0; margin: 0; }

View File

@@ -1,138 +1,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Task 1.1.0</title>
<title>Task 1.3.1</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
text-align: center;
margin: 0; padding: 1em;
}
#container {
width: 740px;
text-align: left;
margin: 0 auto; padding: 0;
}
#header {
height: 60px;
margin: 0 0 15px; padding: 0;
}
#page {}
#content {
width: 500px;
}
#header a:link,
#header a:visited {
color:#000;
text-decoration: none;
}
#header h1 {
font: bold 400% georgia, serif;
letter-spacing: -1px;
margin: 0;
float: left;
}
#header h2 {
font: normal 12px verdana, arial, sans-serif;
margin: 2.5em 0 0 0.8em;
float: left;
}
#content {}
#content h1,
#content h2,
#content h3,
#content h4,
#content h5 {
font-family: "lucidamac bold", "lucida grande", arial, sans-serif;
letter-spacing: -1px;
}
#content h1 {
font-size: 24px;
margin: 0 0 0.3em;
}
#content h2 {
font-size: 22px;
margin: 0 0 0.3em;
}
#content h3 {
font-size: 20px;
margin: 1.2em 0 0.3em;
}
#content h4 {
font-size: 18px;
margin: 1.2em 0 0.3em;
border-bottom: 1px dotted #bbb;
}
#content h5 {
font-size: 18px;
background: #ffd;
margin: 1.2em 0 0.3em;
border-bottom: 1px dotted #aaa;
}
#content p {
line-height: 15px;
margin: 0 0 1.2em;
}
#content ul,
#content ol {
margin: 1em;
padding:0;
}
#content code {
font: normal 12px "bitstream vera sans mono", monaco "lucida console", "courier new", courier, serif;
}
#content pre {
color: #63FF00;
background: #000;
overflow: auto;
font: normal 12px "bitstream vera sans mono", monaco "lucida console", "courier new", courier, serif;
margin: 0.9em 0; padding: 8px;
}
dt {
font: bold 14px "lucida grande", verdana, arial, helvetica, sans-serif;
}
dd {
}
body {
font: normal 12px "lucida grande", verdana, arial, helvetica, sans-serif;
}
.table_h {
background-color: #e0e0e0;
}
.table_d {
background-color: #f7f7f7;
}
input,
textarea { font: normal 12px "bitstream vera sans", verdana, sans-serif; }
abbr { border: none; }
cite { font-style: normal; }
a img { border: none; padding: 0; margin: 0; }
</style>
<link rel="stylesheet" href="task.css" type="text/css" />
</head>
<body>
@@ -166,22 +37,36 @@ a img { border: none; padding: 0; margin: 0; }
<h2 class="title">Get the Source Code</h2>
<div class="content">
<p>
Download the latest task source code
<a href="http://www.beckingham.net/task-1.1.0.tar.gz">task-1.1.0.tar.gz</a>
(6/7/2008).
Download the
<a href="http://www.beckingham.net/task-1.3.1.tar.gz">latest version</a>
of the task source code (1.3.1, 6/21/2008).
</p>
New in version 1.1.0:
<p>
<h4>New in version 1.3.1</h4>
Source: <a href="http://www.beckingham.net/task-1.3.1.tar.gz">task-1.3.1.tar.gz</a>
<br />
Debian package: <a href="http://www.beckingham.net/task_1.3.1-1_i386.deb">task_1.3.1-1_i386.deb</a>
(Thanks to <a href="http://blog.rfquerin.org">Richard Querin</a>)
</p>
<ul>
<li>"blanklines" configuration variable to stop displaying unnecessary
white space and thus work better on small-screen devices
<li>"dateformat" configuration now determines how dates are formatted
<li>Better formatting of "task tags" output
<li>This home page set up, with TUTORIAL
<li>Added tags to the "task long" report
<li>New configuration variable "defaultwidth" determines the width
of windows in the absense of ncurses support
<li>Fixed bug where "showage" configuration variable was not being
oberved by the "task long" report
<li>Fixed bug causing segmentation faults (mostly for Ubuntu users)
when various commands are run
<li>Fixed bug so that task now will recreate a missing ~/.taskrc file,
OR a missing ~/.task directory
</ul>
<p>
(Find out <a href="versions.html">what was new in prior versions</a>)
</p>
<p>
<h4>Troubleshooting</h4>
</p>
<p>
@@ -203,6 +88,12 @@ a img { border: none; padding: 0; margin: 0; }
suggestion for improvement, or a feature request, please send mail to
<a href="mailto:task@beckingham.net">task@beckingham.net</a>.
</p>
<p>
Take a look at the <a href="troubleshooting.html">troubleshooting guide</a>
for tips and workarounds to problems.
</p>
</div>
<br />
@@ -212,6 +103,12 @@ a img { border: none; padding: 0; margin: 0; }
This guide shows how to quickly set up the task program, and become
proficient with it.
</p>
<p>
Alternatively, watch the
<a href="http://www.youtube.com/watch?v=D2Kn4DMOVSw">task movie</a>
which illustrates many of task's features.
</p>
</div>
<br />
@@ -223,10 +120,10 @@ a img { border: none; padding: 0; margin: 0; }
</p>
<pre><code>% ls
task-1.1.0.tar.gz
% gunzip task-1.1.0.tar.gz
% tar xf task-1.1.0.tar
% cd task-1.1.0
task-1.3.0.tar.gz
% gunzip task-1.3.0.tar.gz
% tar xf task-1.3.0.tar
% cd task-1.3.0
% ./configure
...
% make
@@ -340,6 +237,52 @@ Permanently delete task? (y/n) y</code></pre>
Wedding project tasks:
</p>
<p>
Subprojects are supported. If you have a project "Wedding", you can
specify that a task is a subproject "Transport" of "Wedding" by
assigning the project "Wedding.Transport". Let's do this:
</p>
<pre><code>% task 2 project:Wedding.Transport
% task ls
ID Project Pri Description
3 Family Send John a birthday card
2 Wedding.Transport Reserve a rental car
1 Wedding Book plane ticket</code></pre>
<p>
Task matches the leftmost part of the project when searching, so
projects may be abbreviated:
</p>
<pre><code>% task ls project:Wedding.Tra
ID Project Pri Description
2 Wedding.Transport Reserve a rental car</code></pre>
<p>
This way of matching projects can be used to see all tasks under
the "Wedding" project and all subprojects:
</p>
<pre><code>% task ls project:Wedding
ID Project Pri Description
2 Wedding.Transport Reserve a rental car
1 Wedding Book plane ticket</code></pre>
<p>
Let's reassign 2 back to the "Wedding" project:
</p>
<pre><code>% task 2 project:Wedding</code></pre>
<p>
Now that projects are assigned, we can look at just the
Wedding project tasks:
</p>
<pre><code>% task ls project:Wedding
ID Project Pri Description
@@ -670,6 +613,18 @@ ID Project Pri Description
12 Errand L Remember to deposit bonus check
...</code></pre>
<strong>% task oldest</strong>
<p>
Lists the oldest tasks. Shows 10 tasks by default, but can be
set via the "oldest" configuration variable.
</p>
<strong>% task newest</strong>
<p>
Lists the newest tasks. Shows 10 tasks by default, but can be
set via the "newest" configuration variable.
</p>
<strong>% task /from/to/</strong>
<p>
If a task has been entered with a typo, it can be easily corrected
@@ -955,7 +910,7 @@ on_white on_bright_white</code></pre>
<p>
The string may also contain other characters to act as spacers,
or formatting. Other values could include:
or formatting. Other values could include (but are not limited to):
</p>
<p>
@@ -978,7 +933,37 @@ on_white on_bright_white</code></pre>
</tr>
</table>
</p>
</dd>
<dt>showage<dt>
<dd>
May be "yes" or "no". Determines whether the "Age"
column appears on the "list" and "next" reports.
<dd>
<dt>monthsperline</dt>
<dd>
Determines how many months the "task calendar" command
renders across the screen. Defaults to 1.
</dd>
<dt>oldest</dt>
<dd>
Determines how many tasks the "task oldest" command displays.
Defaults to 10.
</dd>
<dt>newest</dt>
<dd>
Determines how many tasks the "task newest" command displays.
Defaults to 10.
</dd>
<dt>defaultwidth</dt>
<dd>
The width of tables used when ncurses support is not available.
Defaults to 80.
</dd>
<dt>color</dt>
<dd>
@@ -1077,6 +1062,8 @@ on_white on_bright_white</code></pre>
task calendar
task active
task overdue
task oldest
task newest
task stats
task usage
task export
@@ -1147,6 +1134,17 @@ Many characters have special meaning to the shell, including:
</table>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4737637-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>

149
html/troubleshooting.html Normal file
View File

@@ -0,0 +1,149 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Task Troubleshooting Guide</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="task.css" type="text/css" />
</head>
<body>
<div id="container">
<table>
<tr>
<td>
<div id="content">
<br />
<br />
<br />
<h1 class="title">Task Troubleshooting Guide</h1>
<p>
Here you will find tips and suggestions for making task behave
properly, and bug workarounds.
</p>
<br />
<h2 class="title">Segmentation Fault for certain commands</h2>
<div class="content">
<p>
Upgrading task to version 1.1.0, 1.2.0 and 1.3.0 can cause
segmentation faults. This is mostly occurring for Ubuntu users,
although there is no reason for it to be limited to Ubuntu.
</p>
<p>
Task 1.3.1 fixes this bug, but there is a workaround for users
of earlier versions. Add the following line to your ~/.taskrc
file:
</p>
<code><pre>dateformat=m/d/Y</pre></code>
<p class="small">
The "dateformat" setting is supported in task 1.1.0 and later.
</p>
</div>
<br />
<h2 class="title">How to get rid of the "Age" column</h2>
<div class="content">
<p>
The "Age" column that shows up on several reports is proving
to be unpopular. In task 1.2.0 and later, here is how to
remove it from the reports - make sure you have the line:
</p>
<code><pre>showage=no</pre></code>
<p>
in your ~/.taskrc file.
Note that the "task long" report does not obey this setting
in versions prior to 1.3.1.
</p>
<p class="small">
The "showage" setting is supported in task 1.2.0 or later.
<br />
The "task long" report supports this setting in versions 1.3.1
or later.
</p>
<div>
<br />
<h2 class="title">How do I build task under Cygwin?</h2>
<div class="content">
<p>
Task is built the same way everywhere. But under Cygwin, you'll
need to make sure you have the following packages available
first:
<ul>
<li>gcc
<li>make
<li>libncurses-devel
<li>libncurses8
</ul>
The gcc and make packages allow you to compile the code, and
are therefore required, but the ncurses packages are optional.
Ncurses will allow task to determine the width of the window, and
therefore use the whole width and wrap text accordingly, for a
more aesthetically pleasing display.
</p>
</div>
<br />
<br />
<div class="content">
<p>
Copyright 2006-2008, P. Beckingham. All rights reserved.
</p>
</div>
</div>
</td>
<td align="right" valign="top" width="200px">
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<script type="text/javascript"><!--
google_ad_client = "pub-9709799404235424";
/* Task Main */
google_ad_slot = "8660617875";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4737637-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>

157
html/versions.html Normal file
View File

@@ -0,0 +1,157 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Task Prior Versions</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="task.css" type="text/css" />
</head>
<body>
<div id="container">
<table>
<tr>
<td>
<div id="content">
<br />
<br />
<br />
<h1 class="title">Task Prior Versions</h1>
<br />
<div class="content">
<p>
<h4>New in version 1.3.0</h4>
Source: <a href="http://www.beckingham.net/task-1.3.0.tar.gz">task-1.3.0.tar.gz</a>
<br />
Debian package: <a href="http://www.beckingham.net/task_1.3.0-0_i386.deb">task_1.3.0-0_i386.deb</a>
(Thanks to <a href="http://blog.rfquerin.org">Richard Querin</a>)
</p>
<ul>
<li>"task calendar" now displays multiple months per line, adjustable
by the "monthsperline" configuration variable. Feature added by
Damian Glenny
<li>Displays shorter message when a command is entered incorrectly,
and the full usage for "task help"
<li>"task export" can now filter tasks like the reports
<li>"task oldest" shows the oldest tasks
<li>"task newest" shows the newest tasks
<li>Fixed bug where task generates a segmentation fault for several
commands, when no "dateformat" configuration variable was present
<li>Fixed bug whereby if you have more than one task with a due date,
7 days gets added to the entry date of task 2..n
<li>Fixed bug whereby "1 wks" was being improperly pluralized
</ul>
<p>
<h4>New in version 1.2.0</h4>
Source: <a href="http://www.beckingham.net/task-1.2.0.tar.gz">task-1.2.0.tar.gz</a>
<br />
Debian package: <a href="http://www.beckingham.net/task_1.2.0-1_i386.deb">task_1.2.0-1_i386.deb</a>
(Thanks to <a href="http://blog.rfquerin.org">Richard Querin</a>)
</p>
<ul>
<li>Subprojects supported - please see documentation below, or TUTORIAL
file
<li>"dateformat" configuration variable now properly used to parse as
well as render dates
<li>"task list x" now performs a caseless comparison between "x" and
the task description
<li>"showage" configuration variable determines whether the "Age" column
should appear on the "task list" and "task next" reports
<li>Improvements to the TUTORIAL file and this page
</ul>
<p>
<h4>New in version 1.1.0</h4>
Source: <a href="http://www.beckingham.net/task-1.1.0.tar.gz">task-1.1.0.tar.gz</a>
<br />
Debian package: <a href="http://www.beckingham.net/task_1.1.0-1_i386.deb">task_1.1.0-1_i386.deb</a>
(Thanks to <a href="http://blog.rfquerin.org">Richard Querin</a>)
</p>
<ul>
<li>"blanklines" configuration variable to stop displaying unnecessary
white space and thus work better on small-screen devices
<li>"dateformat" configuration now determines how dates are formatted
<li>Better formatting of "task tags" output
<li>This home page set up, with TUTORIAL
<li>Added tags to the "task long" report
</ul>
<p>
<h4>New in version 1.0.1</h4>
Source: <a href="http://www.beckingham.net/task-1.0.1.tar.gz">task-1.0.1.tar.gz</a>
</p>
<ul>
<li>Fixed bug where the UUID generator not properly terminating strings
<li>Fixed bug where srandom/srand not called prior to custom UUID generation
</ul>
<p>
<h4>Version 1.0.0</h4>
Source: <a href="http://www.beckingham.net/task-1.0.0.tar.gz">task-1.0.0.tar.gz</a>
</p>
<p>
Task 1.0.0 was the first publicly available version of task.
</p>
</div>
<br />
<br />
<div class="content">
<p>
Copyright 2006-2008, P. Beckingham. All rights reserved.
</p>
</div>
</div>
</td>
<td align="right" valign="top" width="200px">
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<script type="text/javascript"><!--
google_ad_client = "pub-9709799404235424";
/* Task Main */
google_ad_slot = "8660617875";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4737637-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>

17
ideas.txt Normal file
View File

@@ -0,0 +1,17 @@
Real Parsing
define grammar for command line
implement flex/bison parser
User-Defined Reports
report.xxx=id,project(2+),priority(1-),description
change all list-based reports to user-defined
Generalized Report Writer
provide column list, sort order, filter
Test Suite
allow .taskrc override
debug=on to cause all cout to be csv
regression tests for every bug, command, feature

View File

@@ -91,14 +91,15 @@ Config.o Config.o: Config.cpp /usr/include/c++/4.0.0/iostream \
/usr/include/c++/4.0.0/bits/istream.tcc /usr/include/c++/4.0.0/fstream \
/usr/include/c++/4.0.0/i686-apple-darwin9/bits/basic_file.h \
/usr/include/c++/4.0.0/bits/fstream.tcc /usr/include/c++/4.0.0/sstream \
/usr/include/c++/4.0.0/bits/sstream.tcc /usr/include/sys/stat.h task.h \
/usr/include/c++/4.0.0/bits/sstream.tcc /usr/include/sys/types.h \
/usr/include/sys/stat.h /usr/include/pwd.h task.h \
/usr/include/c++/4.0.0/vector /usr/include/c++/4.0.0/bits/stl_vector.h \
/usr/include/c++/4.0.0/bits/stl_bvector.h \
/usr/include/c++/4.0.0/bits/vector.tcc /usr/include/c++/4.0.0/map \
/usr/include/c++/4.0.0/bits/stl_tree.h \
/usr/include/c++/4.0.0/bits/stl_map.h \
/usr/include/c++/4.0.0/bits/stl_multimap.h /usr/include/sys/types.h \
Config.h Table.h color.h Grid.h color.h TDB.h T.h ../auto.h
/usr/include/c++/4.0.0/bits/stl_multimap.h Config.h Table.h color.h \
Grid.h color.h TDB.h T.h ../auto.h
/usr/include/c++/4.0.0/iostream:
@@ -366,8 +367,12 @@ Config.o Config.o: Config.cpp /usr/include/c++/4.0.0/iostream \
/usr/include/c++/4.0.0/bits/sstream.tcc:
/usr/include/sys/types.h:
/usr/include/sys/stat.h:
/usr/include/pwd.h:
task.h:
/usr/include/c++/4.0.0/vector:
@@ -386,8 +391,6 @@ task.h:
/usr/include/c++/4.0.0/bits/stl_multimap.h:
/usr/include/sys/types.h:
Config.h:
Table.h:

2
src/.gitignore vendored
View File

@@ -1,2 +1,2 @@
Makefile
./Makefile
*.o

View File

@@ -27,8 +27,11 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <pwd.h>
#include "task.h"
#include "Config.h"
@@ -84,38 +87,37 @@ bool Config::load (const std::string& file)
}
////////////////////////////////////////////////////////////////////////////////
void Config::createDefault (const std::string& file)
void Config::createDefault (const std::string& home)
{
if (confirm (
"A configuration file could not be found in "
+ file
+ "\n\n"
+ "Would you like a sample .taskrc created, so task can proceed?"))
{
// Determine a path to the task directory.
std::string taskDir = "";
for (int i = file.length () - 1; i >= 0; --i)
{
if (file[i] == '/')
{
taskDir = file.substr (0, i) + "/.task";
if (-1 == access (taskDir.c_str (), F_OK))
mkdir (taskDir.c_str (), S_IRWXU);
break;
}
}
// Strip trailing slash off home directory, if necessary.
std::string terminatedHome = home;
if (home[home.length () - 1] == '/')
terminatedHome = home.substr (0, home.length () - 1);
if (taskDir != "")
// Determine default names of init file and task directory.
std::string rcFile = terminatedHome + "/.taskrc";
std::string dataDir = terminatedHome + "/.task";;
// If rcFile is not found, offer to create one.
if (-1 == access (rcFile.c_str (), F_OK))
{
if (confirm (
"A configuration file could not be found in "
+ rcFile
+ "\n\n"
+ "Would you like a sample .taskrc created, so task can proceed?"))
{
// Create a sample .taskrc file.
FILE* out;
if ((out = fopen (file.c_str (), "w")))
if ((out = fopen (rcFile.c_str (), "w")))
{
fprintf (out, "data.location=%s\n", taskDir.c_str ());
fprintf (out, "data.location=%s\n", dataDir.c_str ());
fprintf (out, "command.logging=off\n");
fprintf (out, "confirmation=yes\n");
fprintf (out, "#nag=Note: try to stick to high priority tasks. See \"task next\".\n");
fprintf (out, "next=2\n");
fprintf (out, "dateformat=m/d/Y\n");
fprintf (out, "showage=yes\n");
fprintf (out, "monthsperline=1\n");
fprintf (out, "curses=on\n");
fprintf (out, "color=on\n");
@@ -132,26 +134,20 @@ void Config::createDefault (const std::string& file)
fclose (out);
// Now set the live values.
set ("data.location", taskDir);
set ("command.logging", "off");
set ("confirmation", "yes");
set ("next", 2);
set ("curses", "on");
set ("color", "on");
set ("color.overdue", "red");
set ("color.active", "cyan");
set ("color.tagged", "yellow");
std::cout << "Done." << std::endl;
}
}
}
this->load (rcFile);
if (-1 == access (dataDir.c_str (), F_OK))
mkdir (dataDir.c_str (), S_IRWXU);
}
////////////////////////////////////////////////////////////////////////////////
// Return the configuration value given the specified key.
const std::string& Config::get (const char* key)
const std::string Config::get (const char* key)
{
return this->get (std::string (key));
}
@@ -159,7 +155,7 @@ const std::string& Config::get (const char* key)
////////////////////////////////////////////////////////////////////////////////
// Return the configuration value given the specified key. If a default_value
// is present, it will be the returned value in the event of a missing key.
const std::string& Config::get (
const std::string Config::get (
const char* key,
const char* default_value)
{
@@ -168,7 +164,7 @@ const std::string& Config::get (
////////////////////////////////////////////////////////////////////////////////
// Return the configuration value given the specified key.
const std::string& Config::get (const std::string& key)
const std::string Config::get (const std::string& key)
{
return (*this)[key];
}
@@ -176,7 +172,7 @@ const std::string& Config::get (const std::string& key)
////////////////////////////////////////////////////////////////////////////////
// Return the configuration value given the specified key. If a default_value
// is present, it will be the returned value in the event of a missing key.
const std::string& Config::get (
const std::string Config::get (
const std::string& key,
const std::string& default_value)
{
@@ -246,29 +242,6 @@ void Config::set (const std::string& key, const std::string& value)
(*this)[key] = value;
}
////////////////////////////////////////////////////////////////////////////////
// The vector form of Config::get assumes the single value is comma-separated,
// and splits accordingly.
void Config::get (
const std::string& key,
std::vector <std::string>& values)
{
values.clear ();
split (values, (*this)[key], ',');
}
////////////////////////////////////////////////////////////////////////////////
// The vector form of Config::set joins the values together with commas, and
// stores the single value.
void Config::set (
const std::string& key,
const std::vector <std::string>& values)
{
std::string conjoined;
join (conjoined, ",", values);
(*this)[key] = conjoined;
}
////////////////////////////////////////////////////////////////////////////////
// Provide a vector of all configuration keys.
void Config::all (std::vector<std::string>& items)

View File

@@ -40,18 +40,16 @@ public:
bool load (const std::string&);
void createDefault (const std::string&);
const std::string& get (const char*);
const std::string& get (const char*, const char*);
const std::string& get (const std::string&);
const std::string& get (const std::string&, const std::string&);
const std::string get (const char*);
const std::string get (const char*, const char*);
const std::string get (const std::string&);
const std::string get (const std::string&, const std::string&);
bool get (const std::string&, bool);
int get (const std::string&, const int);
double get (const std::string&, const double);
void get (const std::string&, std::vector <std::string>&);
void set (const std::string&, const int);
void set (const std::string&, const double);
void set (const std::string&, const std::string&);
void set (const std::string&, const std::vector <std::string>&);
void all (std::vector <std::string>&);
};

View File

@@ -57,29 +57,134 @@ Date::Date (const int m, const int d, const int y)
}
////////////////////////////////////////////////////////////////////////////////
Date::Date (const std::string& mdy)
Date::Date (const std::string& mdy, const std::string& format /* = "m/d/Y" */)
{
size_t firstSlash = mdy.find ("/");
size_t secondSlash = mdy.find ("/", firstSlash + 1);
if (firstSlash != std::string::npos &&
secondSlash != std::string::npos)
{
int m = ::atoi (mdy.substr (0, firstSlash ).c_str ());
int d = ::atoi (mdy.substr (firstSlash + 1, secondSlash - firstSlash).c_str ());
int y = ::atoi (mdy.substr (secondSlash + 1, std::string::npos ).c_str ());
if (!valid (m, d, y))
throw std::string ("\"") + mdy + "\" is not a valid date.";
int month = 0;
int day = 0;
int year = 0;
// Duplicate Date::Date (const int, const int, const int);
struct tm t = {0};
t.tm_mday = d;
t.tm_mon = m - 1;
t.tm_year = y - 1900;
unsigned int i = 0; // Index into mdy.
for (unsigned int f = 0; f < format.length (); ++f)
{
switch (format[f])
{
// Single or double digit.
case 'm':
if (i >= mdy.length () ||
! ::isdigit (mdy[i]))
{
throw std::string ("\"") + mdy + "\" is not a valid date.";
}
if (i + 1 < mdy.length () &&
mdy[i + 0] == '1' &&
(mdy[i + 1] == '0' || mdy[i + 1] == '1' || mdy[i + 1] == '2'))
{
month = ::atoi (mdy.substr (i, 2).c_str ());
i += 2;
}
else
{
month = ::atoi (mdy.substr (i, 1).c_str ());
++i;
}
break;
case 'd':
if (i >= mdy.length () ||
! ::isdigit (mdy[i]))
{
throw std::string ("\"") + mdy + "\" is not a valid date.";
}
if (i + 1 < mdy.length () &&
(mdy[i + 0] == '1' || mdy[i + 0] == '2' || mdy[i + 0] == '3') &&
::isdigit (mdy[i + 1]))
{
day = ::atoi (mdy.substr (i, 2).c_str ());
i += 2;
}
else
{
day = ::atoi (mdy.substr (i, 1).c_str ());
++i;
}
break;
// Double digit.
case 'y':
if (i + 1 >= mdy.length () ||
! ::isdigit (mdy[i + 0]) ||
! ::isdigit (mdy[i + 1]))
{
throw std::string ("\"") + mdy + "\" is not a valid date.";
}
year = ::atoi (mdy.substr (i, 2).c_str ()) + 2000;
i += 2;
break;
case 'M':
if (i + 1 >= mdy.length () ||
! ::isdigit (mdy[i + 0]) ||
! ::isdigit (mdy[i + 1]))
{
throw std::string ("\"") + mdy + "\" is not a valid date.";
}
month = ::atoi (mdy.substr (i, 2).c_str ());
i += 2;
break;
case 'D':
if (i + 1 >= mdy.length () ||
! ::isdigit (mdy[i + 0]) ||
! ::isdigit (mdy[i + 1]))
{
throw std::string ("\"") + mdy + "\" is not a valid date.";
}
day = ::atoi (mdy.substr (i, 2).c_str ());
i += 2;
break;
// Quadruple digit.
case 'Y':
if (i + 3 >= mdy.length () ||
! ::isdigit (mdy[i + 0]) ||
! ::isdigit (mdy[i + 1]) ||
! ::isdigit (mdy[i + 2]) ||
! ::isdigit (mdy[i + 3]))
{
throw std::string ("\"") + mdy + "\" is not a valid date.";
}
year = ::atoi (mdy.substr (i, 4).c_str ());
i += 4;
break;
default:
if (i >= mdy.length () ||
mdy[i] != format[f])
{
throw std::string ("\"") + mdy + "\" is not a valid date.";
}
++i;
break;
}
}
if (!valid (month, day, year))
throw std::string ("\"") + mdy + "\" is not a valid date.";
// Duplicate Date::Date (const int, const int, const int);
struct tm t = {0};
t.tm_mday = day;
t.tm_mon = month - 1;
t.tm_year = year - 1900;
mT = mktime (&t);
}
else
throw std::string ("\"") + mdy + "\" is not a valid date.";
}
////////////////////////////////////////////////////////////////////////////////
@@ -116,74 +221,29 @@ void Date::toMDY (int& m, int& d, int& y)
}
////////////////////////////////////////////////////////////////////////////////
std::string Date::toString (const std::string& format /*= "m/d/Y"*/)
const std::string Date::toString (const std::string& format /*= "m/d/Y" */) const
{
/*
int m, d, y;
toMDY (m, d, y);
char formatted [11];
sprintf (formatted, "%d/%d/%d", m, d, y);
return std::string (formatted);
*/
// Making this local copy seems to fix a bug. Remove the local copy and you'll
// see segmentation faults and all kinds of gibberish.
std::string localFormat = format;
char buffer[12];
std::string formatted;
for (unsigned int i = 0; i < format.length (); ++i)
for (unsigned int i = 0; i < localFormat.length (); ++i)
{
switch (format[i])
char c = localFormat[i];
switch (c)
{
case 'm':
{
char m[3];
sprintf (m, "%d", this->month ());
formatted += m;
}
break;
case 'M':
{
char m[3];
sprintf (m, "%02d", this->month ());
formatted += m;
}
break;
case 'd':
{
char d[3];
sprintf (d, "%d", this->day ());
formatted += d;
}
break;
case 'D':
{
char d[3];
sprintf (d, "%02d", this->day ());
formatted += d;
}
break;
case 'y':
{
char y[3];
sprintf (y, "%02d", this->year () % 100);
formatted += y;
}
break;
case 'Y':
{
char y[5];
sprintf (y, "%d", this->year ());
formatted += y;
}
break;
default:
formatted += format[i];
break;
case 'm': sprintf (buffer, "%d", this->month ()); break;
case 'M': sprintf (buffer, "%02d", this->month ()); break;
case 'd': sprintf (buffer, "%d", this->day ()); break;
case 'D': sprintf (buffer, "%02d", this->day ()); break;
case 'y': sprintf (buffer, "%02d", this->year () % 100); break;
case 'Y': sprintf (buffer, "%d", this->year ()); break;
default: sprintf (buffer, "%c", c); break;
}
formatted += buffer;
}
return formatted;

View File

@@ -37,14 +37,14 @@ public:
Date ();
Date (time_t);
Date (const int, const int, const int);
Date (const std::string&);
Date (const std::string&, const std::string& format = "m/d/Y");
Date (const Date&);
virtual ~Date ();
void toEpoch (time_t&);
time_t toEpoch ();
void toMDY (int&, int&, int&);
std::string toString (const std::string& format = "m/d/Y");
const std::string toString (const std::string& format = "m/d/Y") const;
static bool valid (const int, const int, const int);
static bool leapYear (int);

View File

@@ -275,20 +275,8 @@ const std::string T::compose () const
int count = 0;
foreach (i, mAttributes)
{
std::string converted = i->second;
// Date attributes may need conversion to epoch.
if (i->first == "due" ||
i->first == "start" ||
i->first == "entry" ||
i->first == "end")
{
if (i->second.find ("/") != std::string::npos)
validDate (converted);
}
line += (count > 0 ? " " : "");
line += i->first + ":" + converted;
line += i->first + ":" + i->second;
++count;
}

View File

@@ -659,6 +659,12 @@ void Table::suppressWS ()
mSuppressWS = true;
}
////////////////////////////////////////////////////////////////////////////////
void Table::setDateFormat (const std::string& dateFormat)
{
mDateFormat = dateFormat;
}
////////////////////////////////////////////////////////////////////////////////
int Table::rowCount ()
{
@@ -771,8 +777,8 @@ void Table::sort (std::vector <int>& order)
else
{
Date dl ((std::string)*left);
Date dr ((std::string)*right);
Date dl ((std::string)*left, mDateFormat);
Date dr ((std::string)*right, mDateFormat);
if (dl > dr)
SWAP
}
@@ -789,8 +795,8 @@ void Table::sort (std::vector <int>& order)
else
{
Date dl ((std::string)*left);
Date dr ((std::string)*right);
Date dl ((std::string)*left, mDateFormat);
Date dr ((std::string)*right, mDateFormat);
if (dl < dr)
SWAP
}

View File

@@ -79,6 +79,7 @@ public:
void setCellBg (int, int, Text::color);
void suppressWS ();
void setDateFormat (const std::string&);
int rowCount ();
int columnCount ();
@@ -128,6 +129,7 @@ private:
// Misc...
bool mSuppressWS;
std::string mDateFormat;
};
#endif

View File

@@ -120,12 +120,15 @@ static const char* commands[] =
"delete",
"done",
"export",
"help",
"history",
"info",
"list",
"long",
"ls",
"newest",
"next",
"oldest",
"overdue",
"projects",
"start",
@@ -185,29 +188,13 @@ static bool isCommand (const std::string& candidate)
}
////////////////////////////////////////////////////////////////////////////////
bool validDate (std::string& date)
bool validDate (std::string& date, Config& conf)
{
size_t firstSlash = date.find ("/");
size_t secondSlash = date.find ("/", firstSlash + 1);
if (firstSlash != std::string::npos &&
secondSlash != std::string::npos)
{
int m = ::atoi (date.substr (0, firstSlash ).c_str ());
int d = ::atoi (date.substr (firstSlash + 1, secondSlash - firstSlash).c_str ());
int y = ::atoi (date.substr (secondSlash + 1, std::string::npos ).c_str ());
if (!Date::valid (m, d, y))
throw std::string ("\"") + date + "\" is not a valid date.";
Date test (date, conf.get ("dateformat", "m/d/Y"));
// Convert to epoch form.
Date dt (m, d, y);
time_t t;
dt.toEpoch (t);
char converted[12];
sprintf (converted, "%u", (unsigned int) t);
date = converted;
}
else
throw std::string ("Badly formed date - use the MM/DD/YYYY format");
char epoch[12];
sprintf (epoch, "%d", (int) test.toEpoch ());
date = epoch;
return true;
}
@@ -227,7 +214,7 @@ static bool validPriority (std::string& input)
}
////////////////////////////////////////////////////////////////////////////////
static bool validAttribute (std::string& name, std::string& value)
static bool validAttribute (std::string& name, std::string& value, Config& conf)
{
guess ("attribute", attributes, name);
@@ -235,7 +222,7 @@ static bool validAttribute (std::string& name, std::string& value)
guess ("color", colors, value);
else if (name == "due" && value != "")
validDate (value);
validDate (value, conf);
else if (name == "priority")
{
@@ -335,7 +322,8 @@ static bool validSubstitution (
void parse (
std::vector <std::string>& args,
std::string& command,
T& task)
T& task,
Config& conf)
{
command = "";
@@ -369,7 +357,7 @@ void parse (
std::string name = arg.substr (0, colon);
std::string value = arg.substr (colon + 1, std::string::npos);
if (validAttribute (name, value))
if (validAttribute (name, value, conf))
task.setAttribute (name, value);
}

View File

@@ -210,8 +210,9 @@ void autoColorize (T& task, Text::color& fg, Text::color& bg)
{
if (it->first.substr (0, 14) == "color.keyword.")
{
std::string value = it->first.substr (14, std::string::npos);
if (task.getDescription ().find (value) != std::string::npos)
std::string value = lowerCase (it->first.substr (14, std::string::npos));
std::string desc = lowerCase (task.getDescription ());
if (desc.find (value) != std::string::npos)
{
fg = gsFg[it->first];
bg = gsBg[it->first];

File diff suppressed because it is too large Load Diff

View File

@@ -36,6 +36,10 @@
#include "T.h"
#include "../auto.h"
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#endif
@@ -49,8 +53,8 @@ for (typeof (c) *foreach_p = & (c); \
++i)
// parse.cpp
void parse (std::vector <std::string>&, std::string&, T&);
bool validDate (std::string&);
void parse (std::vector <std::string>&, std::string&, T&, Config&);
bool validDate (std::string&, Config&);
// task.cpp
void handleAdd (const TDB&, T&, Config&);
@@ -69,6 +73,8 @@ void handleReportCalendar (const TDB&, T&, Config&);
void handleReportActive (const TDB&, T&, Config&);
void handleReportOverdue (const TDB&, T&, Config&);
void handleReportStats (const TDB&, T&, Config&);
void handleReportOldest (const TDB&, T&, Config&);
void handleReportNewest (const TDB&, T&, Config&);
void handleVersion (Config&);
void handleExport (const TDB&, T&, Config&);
void handleDelete (const TDB&, T&, Config&);

View File

@@ -1,5 +1,6 @@
t.t
tdb.t
date.t
pending.data
completed.data

28
src/tests/Makefile Normal file
View File

@@ -0,0 +1,28 @@
PROJECT = t.t tdb.t date.t
CFLAGS = -I. -I.. -Wall -pedantic -ggdb3 -fno-rtti
LFLAGS = -L/usr/local/lib
OBJECTS = ../TDB.o ../T.o ../parse.o ../text.o ../Date.o ../util.o ../Config.o
all: $(PROJECT)
install: $(PROJECT)
@echo unimplemented
test: $(PROJECT)
@echo unimplemented
clean:
-rm *.o $(PROJECT)
.cpp.o:
g++ -c $(CFLAGS) $<
t.t: t.t.o $(OBJECTS) test.o
g++ t.t.o $(OBJECTS) test.o $(LFLAGS) -o t.t
tdb.t: tdb.t.o $(OBJECTS) test.o
g++ tdb.t.o $(OBJECTS) test.o $(LFLAGS) -o tdb.t
date.t: date.t.o $(OBJECTS) test.o
g++ date.t.o $(OBJECTS) test.o $(LFLAGS) -o date.t

View File

@@ -9,78 +9,104 @@
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest t (46);
plan (63);
Date now;
Date yesterday;
yesterday -= 1;
t.ok (yesterday <= now, "yesterday <= now");
t.ok (yesterday < now, "yesterday < now");
t.notok (yesterday == now, "!(yesterday == now)");
t.ok (yesterday != now, "yesterday != now");
t.ok (now >= yesterday, "now >= yesterday");
t.ok (now > yesterday, "now > yesterday");
ok (yesterday <= now, "yesterday <= now");
ok (yesterday < now, "yesterday < now");
notok (yesterday == now, "!(yesterday == now)");
ok (yesterday != now, "yesterday != now");
ok (now >= yesterday, "now >= yesterday");
ok (now > yesterday, "now > yesterday");
t.ok (Date::valid (2, 29, 2008), "valid: 2/29/2008");
t.notok (Date::valid (2, 29, 2007), "invalid: 2/29/2007");
ok (Date::valid (2, 29, 2008), "valid: 2/29/2008");
notok (Date::valid (2, 29, 2007), "invalid: 2/29/2007");
t.ok (Date::leapYear (2008), "2008 is a leap year");
t.notok (Date::leapYear (2007), "2007 is not a leap year");
ok (Date::leapYear (2008), "2008 is a leap year");
notok (Date::leapYear (2007), "2007 is not a leap year");
ok (Date::leapYear (2000), "2000 is a leap year");
ok (Date::leapYear (1900), "1900 is a leap year");
t.is (Date::daysInMonth (2, 2008), 29, "29 days in February 2008");
t.is (Date::daysInMonth (2, 2007), 28, "28 days in February 2007");
is (Date::daysInMonth (2, 2008), 29, "29 days in February 2008");
is (Date::daysInMonth (2, 2007), 28, "28 days in February 2007");
t.is (Date::monthName (1), "January", "1 = January");
t.is (Date::monthName (2), "February", "2 = February");
t.is (Date::monthName (3), "March", "3 = March");
t.is (Date::monthName (4), "April", "4 = April");
t.is (Date::monthName (5), "May", "5 = May");
t.is (Date::monthName (6), "June", "6 = June");
t.is (Date::monthName (7), "July", "7 = July");
t.is (Date::monthName (8), "August", "8 = August");
t.is (Date::monthName (9), "September", "9 = September");
t.is (Date::monthName (10), "October", "10 = October");
t.is (Date::monthName (11), "November", "11 = November");
t.is (Date::monthName (12), "December", "12 = December");
is (Date::monthName (1), "January", "1 = January");
is (Date::monthName (2), "February", "2 = February");
is (Date::monthName (3), "March", "3 = March");
is (Date::monthName (4), "April", "4 = April");
is (Date::monthName (5), "May", "5 = May");
is (Date::monthName (6), "June", "6 = June");
is (Date::monthName (7), "July", "7 = July");
is (Date::monthName (8), "August", "8 = August");
is (Date::monthName (9), "September", "9 = September");
is (Date::monthName (10), "October", "10 = October");
is (Date::monthName (11), "November", "11 = November");
is (Date::monthName (12), "December", "12 = December");
t.is (Date::dayName (0), "Sunday", "0 == Sunday");
t.is (Date::dayName (1), "Monday", "1 == Monday");
t.is (Date::dayName (2), "Tuesday", "2 == Tuesday");
t.is (Date::dayName (3), "Wednesday", "3 == Wednesday");
t.is (Date::dayName (4), "Thursday", "4 == Thursday");
t.is (Date::dayName (5), "Friday", "5 == Friday");
t.is (Date::dayName (6), "Saturday", "6 == Saturday");
is (Date::dayName (0), "Sunday", "0 == Sunday");
is (Date::dayName (1), "Monday", "1 == Monday");
is (Date::dayName (2), "Tuesday", "2 == Tuesday");
is (Date::dayName (3), "Wednesday", "3 == Wednesday");
is (Date::dayName (4), "Thursday", "4 == Thursday");
is (Date::dayName (5), "Friday", "5 == Friday");
is (Date::dayName (6), "Saturday", "6 == Saturday");
Date happyNewYear (1, 1, 2008);
t.is (happyNewYear.dayOfWeek (), 2, "1/1/2008 == Tuesday");
t.is (happyNewYear.month (), 1, "1/1/2008 == January");
t.is (happyNewYear.day (), 1, "1/1/2008 == 1");
t.is (happyNewYear.year (), 2008, "1/1/2008 == 2008");
is (happyNewYear.dayOfWeek (), 2, "1/1/2008 == Tuesday");
is (happyNewYear.month (), 1, "1/1/2008 == January");
is (happyNewYear.day (), 1, "1/1/2008 == 1");
is (happyNewYear.year (), 2008, "1/1/2008 == 2008");
t.is (now - yesterday, 1, "today - yesterday == 1");
is (now - yesterday, 1, "today - yesterday == 1");
t.is (happyNewYear.toString (), "1/1/2008", "toString 1/1/2008");
is (happyNewYear.toString (), "1/1/2008", "toString 1/1/2008");
int m, d, y;
happyNewYear.toMDY (m, d, y);
t.is (m, 1, "1/1/2008 == January");
t.is (d, 1, "1/1/2008 == 1");
t.is (y, 2008, "1/1/2008 == 2008");
is (m, 1, "1/1/2008 == January");
is (d, 1, "1/1/2008 == 1");
is (y, 2008, "1/1/2008 == 2008");
Date epoch (9, 8, 2001);
t.ok ((int)epoch.toEpoch () < 1000000000, "9/8/2001 < 1,000,000,000");
ok ((int)epoch.toEpoch () < 1000000000, "9/8/2001 < 1,000,000,000");
epoch += 86400;
t.ok ((int)epoch.toEpoch () > 1000000000, "9/9/2001 > 1,000,000,000");
ok ((int)epoch.toEpoch () > 1000000000, "9/9/2001 > 1,000,000,000");
Date fromEpoch (epoch.toEpoch ());
t.is (fromEpoch.toString (), epoch.toString (), "ctor (time_t)");
is (fromEpoch.toString (), epoch.toString (), "ctor (time_t)");
Date fromString ("1/1/2008");
t.is (fromString.month (), 1, "ctor (std::string) -> m");
t.is (fromString.day (), 1, "ctor (std::string) -> d");
t.is (fromString.year (), 2008, "ctor (std::string) -> y");
Date fromString1 ("1/1/2008");
is (fromString1.month (), 1, "ctor (std::string) -> m");
is (fromString1.day (), 1, "ctor (std::string) -> d");
is (fromString1.year (), 2008, "ctor (std::string) -> y");
Date fromString2 ("1/1/2008", "m/d/Y");
is (fromString2.month (), 1, "ctor (std::string) -> m");
is (fromString2.day (), 1, "ctor (std::string) -> d");
is (fromString2.year (), 2008, "ctor (std::string) -> y");
Date fromString3 ("20080101", "YMD");
is (fromString3.month (), 1, "ctor (std::string) -> m");
is (fromString3.day (), 1, "ctor (std::string) -> d");
is (fromString3.year (), 2008, "ctor (std::string) -> y");
Date fromString4 ("12/31/2007");
is (fromString4.month (), 12, "ctor (std::string) -> m");
is (fromString4.day (), 31, "ctor (std::string) -> d");
is (fromString4.year (), 2007, "ctor (std::string) -> y");
Date fromString5 ("12/31/2007", "m/d/Y");
is (fromString5.month (), 12, "ctor (std::string) -> m");
is (fromString5.day (), 31, "ctor (std::string) -> d");
is (fromString5.year (), 2007, "ctor (std::string) -> y");
Date fromString6 ("20071231", "YMD");
is (fromString6.month (), 12, "ctor (std::string) -> m");
is (fromString6.day (), 31, "ctor (std::string) -> d");
is (fromString6.year (), 2007, "ctor (std::string) -> y");
return 0;
}

View File

@@ -80,19 +80,19 @@ void formatTimeDeltaDays (std::string& output, time_t delta)
if (days > 365)
sprintf (formatted, "%.1f yrs", (days / 365.2422));
else if (days > 84)
sprintf (formatted, "%1d mths", (int) (days / 30.6));
sprintf (formatted, "%1d mth%s", (int) (days / 30.6), ((int) (days / 30.6) == 1 ? "" : "s"));
else if (days > 13)
sprintf (formatted, "%d wks", (int) (days / 7.0));
sprintf (formatted, "%d wk%s", (int) (days / 7.0), ((int) (days / 7.0) == 1 ? "" : "s"));
else if (days > 5.0)
sprintf (formatted, "%d days", (int) days);
sprintf (formatted, "%d day%s", (int) days, ((int) days == 1 ? "" : "s"));
else if (days > 1.0)
sprintf (formatted, "%.1f days", days);
else if (days * 24 > 1.0)
sprintf (formatted, "%d hrs", (int) (days * 24.0));
sprintf (formatted, "%d hr%s", (int) (days * 24.0), ((int) (days * 24.0) == 1 ? "" : "s"));
else if (days * 24 * 60 > 1)
sprintf (formatted, "%d mins", (int) (days * 24 * 60));
sprintf (formatted, "%d min%s", (int) (days * 24 * 60), ((int) (days * 24 * 60) == 1 ? "" : "s"));
else if (days * 24 * 60 * 60 > 1)
sprintf (formatted, "%d secs", (int) (days * 24 * 60 * 60));
sprintf (formatted, "%d sec%s", (int) (days * 24 * 60 * 60), ((int) (days * 24 * 60 * 60) == 1 ? "" : "s"));
else
strcpy (formatted, "-");
@@ -108,19 +108,19 @@ std::string formatSeconds (time_t delta)
if (days > 365)
sprintf (formatted, "%.1f yrs", (days / 365.2422));
else if (days > 84)
sprintf (formatted, "%1d mths", (int) (days / 30.6));
sprintf (formatted, "%1d mth%s", (int) (days / 30.6), ((int) (days / 30.6) == 1 ? "" : "s"));
else if (days > 13)
sprintf (formatted, "%d wks", (int) (days / 7.0));
sprintf (formatted, "%d wk%s", (int) (days / 7.0), ((int) (days / 7.0) == 1 ? "" : "s"));
else if (days > 5.0)
sprintf (formatted, "%d days", (int) days);
sprintf (formatted, "%d day%s", (int) days, ((int) days == 1 ? "" : "s"));
else if (days > 1.0)
sprintf (formatted, "%.1f days", days);
else if (days * 24 > 1.0)
sprintf (formatted, "%d hrs", (int) (days * 24.0));
sprintf (formatted, "%d hr%s", (int) (days * 24.0), ((int) (days * 24) == 1 ? "" : "s"));
else if (days * 24 * 60 > 1)
sprintf (formatted, "%d mins", (int) (days * 24 * 60));
sprintf (formatted, "%d min%s", (int) (days * 24 * 60), ((int) (days * 24 * 60) == 1 ? "" : "s"));
else if (days * 24 * 60 * 60 > 1)
sprintf (formatted, "%d secs", (int) (days * 24 * 60 * 60));
sprintf (formatted, "%d sec%s", (int) (days * 24 * 60 * 60), ((int) (days * 24 * 60 * 60) == 1 ? "" : "s"));
else
strcpy (formatted, "-");