Compare commits

...

21 Commits

Author SHA1 Message Date
Paul Beckingham
89d4dd74da - Corrected platform list. 2008-06-03 23:23:22 -04:00
Paul Beckingham
9ff83281c5 - Updated ChangeLog. 2008-06-03 23:17:11 -04:00
Paul Beckingham
787b3b4a51 - Added YouTube reference to new movie.
- Corrected coloration in "task calendar" command.
2008-06-03 23:16:40 -04:00
Paul Beckingham
74e77e4dc5 - Added legend to "task calendar" output 2008-06-03 09:09:52 -04:00
Paul Beckingham
f73c64801c - Added three new colorization rules - color.tag.x, color.project.x, color.keyword.x.
- Updated default .taskrc file.
- Updated docs accordingly.
2008-06-03 09:00:51 -04:00
Paul Beckingham
039c3119ff - problem on Solaris 10 fixed, docs updated 2008-06-02 10:54:54 -04:00
Paul Beckingham
fb9f5e2ab3 - Editorial 2008-06-01 22:20:24 -04:00
Paul Beckingham
3077c50774 - "calendar" command now uses oldest and newest due dates for limits. 2008-06-01 15:44:26 -04:00
Paul Beckingham
0ec24aaef5 - Added spoken parts, improved commands. 2008-06-01 13:44:02 -04:00
Paul Beckingham
1a580b1967 - Removed unnecessary TODO items from the source code. 2008-05-30 22:10:06 -04:00
Paul Beckingham
fd8f63dec6 - Removed debugging, obsolete code. 2008-05-30 22:07:06 -04:00
Paul Beckingham
7c9554e8c5 - Modified AUTHORS file.
- Added announcement.txt file for the mailing list.
2008-05-30 22:00:19 -04:00
Paul Beckingham
f57e22124f - Added text to README file. 2008-05-30 21:41:06 -04:00
Paul Beckingham
9aec4efefa - Added proper copyright, licensing details to all source.
- Eliminated redundant stlmacros.h heaer file.
2008-05-30 21:35:49 -04:00
Paul Beckingham
8a0b8e0328 - Updated all documents. 2008-05-30 21:22:22 -04:00
Paul Beckingham
1aa9051885 - Fixed bug whereby a % character could not be used in a description. Problem was use of fprintf, which when changed to fputs, fixed the problem. 2008-05-30 20:59:28 -04:00
Paul Beckingham
654eb260c7 - Recorded new "task calendar" behavior. 2008-05-30 20:24:53 -04:00
Paul Beckingham
b061ef6191 - "task calendar" now lists all months that contain pending due tasks. 2008-05-30 20:22:38 -04:00
Paul Beckingham
86a9f0f6d5 - Release candidate 1
- Fixed bug where stats were gibberish whne there were no tasks, ie a new user.
2008-05-29 10:33:56 -04:00
Paul Beckingham
0bf87ed311 - Fixed bug where "task version" asserted on mobile device. 2008-05-28 10:53:24 -04:00
Paul Beckingham
abc9aa08ec - Fixed bug where "task projects" rendered an empty table instead of saying "no projects". 2008-05-27 21:03:27 -04:00
47 changed files with 902 additions and 422 deletions

View File

@@ -3,5 +3,4 @@ Principal Author
Contributing Authors
Testers

59
COPYING
View File

@@ -278,63 +278,4 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -1,20 +1,23 @@
1.1.0 (?)
- Command line specification of .taskrc file
1.0.0 (?)
- New movie made, uploaded
- Bug: assertion fails on mobile for t v
- Bug: configure.ac does not properly determine ncurses availability
- Bug: when run without arguments, task dumps core on Solaris 10
- Bug: Cannot seem to use the percent character in a task description
- Bug: New installation "task stats" reports newest task 12/31/1969
- Bug: New installation task projects displays header but no data - should short-circuit
+ Bug: incorrect color specification in sample .taskrc file
- Command line specification of alternate .taskrc file
------ reality -----------------------------------
1.0.0 (6/3/2008)
+ New movie made, uploaded
+ Bug: assertion fails on mobile for t v
+ Bug: configure.ac does not properly determine ncurses availability
+ Bug: Cannot seem to use the percent character in a task description
+ Bug: New installation "task stats" reports newest task 12/31/1969
+ Bug: New installation task projects displays header but no data - should short-circuit
+ Bug: incorrect color specification in sample .taskrc file
+ Bug: when run without arguments, task dumps core on Solaris 10
+ "task calendar" now reports all months with due pending tasks
+ Added rules for colorization by tag, project and keyword
+ Added legend to "task calendar"
0.9.9 (5/27/2008)
+ Autoconf/autmake behaving properly.
+ Autoconf/automake behaving properly.
+ Clean build on OS X 10.5.
+ Clean build on Ubuntu 8.0.
+ Clean build on Fedora Core 8.

View File

@@ -16,5 +16,5 @@ included.
color.cpp Color support functions.
rules.cpp Auto-colorization rules.
Don't forget, please send patches to task@beckingham.net
Don't forget, please send bugs, patches to task@beckingham.net

12
NEWS
View File

@@ -2,22 +2,20 @@ Welcome to Task 1.0.0.
Task has been built and tested on the following configurations:
- OS X 10.4 Tiger
- OS X 10.5 Leopard
- Fedora Core 8
- Fedora Core 9
- Ubuntu 8
Known Issues:
- problems running on Solaris 10
- Ubuntu 8 Hardy Heron
- Solaris 10
While Task has undergone testing, bugs are sure to remain. If you encounter a
bug, please contact me at bugs@beckingham.net. Here is what you could do, in
bug, please contact me at task@beckingham.net. Here is what you could do, in
order of increasing effort (to you) and usefulness (to me):
- Do nothing. Bug probably won't get fixed.
- Send an email to bugs@beckingham.net, explaining what you saw. The bug
- Send an email to task@beckingham.net, explaining what you saw. The bug
will be addressed, and a new release will be made. You will be a hero.
- Send an email, and a reproducible test case in the form of the few commands

6
README
View File

@@ -4,6 +4,7 @@ Thank you for taking a look at task. Task is a GTD utility featuring:
- Tags
- Colorful, tabular output
- Reports
- Lots of commands
- Low-level API
- Abbreviations for all commands, options
- Multi-user file locking
@@ -21,7 +22,7 @@ task movie on YouTube:
or the new improved one:
http:/www.youtube.com/watch?v=????????????
http://www.youtube.com/watch?v=D2Kn4DMOVSw
Either will give you a fairly good idea of what task is capable of, and whether
it fits in to your way of working. As a command line application, task is not
@@ -42,3 +43,6 @@ All feedback is welcome, in addition to any bug reports or patches to:
Got an idea for an enhancement? Send a message!
I have found that task makes me more productive and organized. I hope task can
do the same for you.

View File

@@ -29,7 +29,7 @@ transcript illustrates a typical installation:
...
% make
...
% make install
% make install # (may require sudo, depending on --prefix)
You need to make sure that the installed task program is in your PATH
environment variable.
@@ -617,6 +617,11 @@ Configuring Task
bold_red on_bright_yellow
color.tag.X Colors any task that has the tag X.
color.project.X Colors any task assigned to project X.
color.keyword.X Colors any task where the description contains X.
Colors

36
announcement.txt Normal file
View File

@@ -0,0 +1,36 @@
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

View File

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

View File

@@ -1,68 +1,105 @@
task add do laundry
task add project:garage order dumpster
task add +phone tell mom i loveher
task add +phone pro:garage schedule goodwill pickup
task add +email pro:garage ask Tom if he wants that old bike
task ls
Hello, and welcome to this quick demo of the task program.
task 1 pro:home
task add do laundry Let's add some tasks
I need to do laundry
task add project:garage order dumpster Oh yeah, the dumpster
task add +phone tell mom i loveher Must call Mom (that "phone" there is a tag - they are
useful for searching, categorizing)
task add +phone pro:garage schedule
goodwill pickup
task ad +email pro:garage ask Tom if Notice I can abbreviating commands
he wants that old bkie
task ls Let's see what we've got
I spelled bike wrong
task 5 /bkie/bike/
task ls That's better
task 1 pro:home Let's assign projects
task 3 pro:home tell mom I love her
task ls pro:garage
task long pro:garage
task list pro:garage
task lis +phone
task li pro:garage +phone
task l mom
task 1 priority:H
task long pro:garage Let's see all the columns
task list pro:garage There are different ways to list
task lis +phone By tag
task li pro:garage +phone By project and tag
task l mom By word
task 1 priority:H Priorities can be High, Medium or Low
task pri:H 3
task 1 pri:M
task li
task li The list is sorted by priority.
task 2 pri:L
task li
task do 3
task li
# There may be an arbitrary number of tags.
task 2 +phone +mistake
task done 3 Suppose task 3 is done
task li ...and it's gone
task 2 +phone +mistake Lets add tags
# Oops!
task 2 -mistake
task tags
task info 2
task 2 -mistake or remove tags
task projects
task tags or look at all the tags
task 3 fg:bold
task li
task 3 fg:white
task info 2 or all the details
task projects or all the projects
task 3 fg:bold Let's make it colorful
task 4 fg:bold_green
task li
task 3 fg:bold_underline_white
task li
task 4 bg:on_bright_red fg:bold_yellow
task li
task li Oh that's just nasty - let's get rid of that.
task 4 bg:
task li
task 4 fg:
task colors
task 3 fg:
task colors There are many combinations to choose from
(Slashes!!!)
task 1 due:6/8/2008 Let's add a due date
date
task 1 due:6/8/2008
task li
task calendar
task 1 due:6/1/2008
task li
task calendar Notice the due task is in yellow, today is marked cyan
task 1 due:5/20/2008 This is now an overdue task
task li and it shows up red
task overdue
task cal
task export file.csv
task export file.csv You can export the tasks to a spreadsheet
cat file.csv
task start 1
task active
task do 1
task li
task do 3
task do 1
task active
task summary
task history
task start 1 Started tasks can be used as reminders
of what you are supposed to be doing
task active They show up as active
task done 1 Let's clear out a couple
task li
task done 3
task active
task summary Summary shows progress on all projects
task history History shows general activity - how many added,
completed etc, by month
And that's it. There are more commands than this
covered in the TUTORIAL file, but this should give
the basic idea.
Thank you for watching.

View File

@@ -98,7 +98,7 @@ Config.o Config.o: Config.cpp /usr/include/c++/4.0.0/iostream \
/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 stlmacros.h ../auto.h
Config.h Table.h color.h Grid.h color.h TDB.h T.h ../auto.h
/usr/include/c++/4.0.0/iostream:
@@ -402,6 +402,4 @@ TDB.h:
T.h:
stlmacros.h:
../auto.h:

View File

@@ -95,8 +95,7 @@ Date.o Date.o: Date.cpp /usr/include/c++/4.0.0/iostream \
/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 stlmacros.h ../auto.h \
Date.h
Config.h Table.h color.h Grid.h color.h TDB.h T.h ../auto.h Date.h
/usr/include/c++/4.0.0/iostream:
@@ -388,8 +387,6 @@ TDB.h:
T.h:
stlmacros.h:
../auto.h:
Date.h:

View File

@@ -95,7 +95,7 @@ T.o T.o: T.cpp /usr/include/c++/4.0.0/iostream \
/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 stlmacros.h ../auto.h
Config.h Table.h color.h Grid.h color.h TDB.h T.h ../auto.h
/usr/include/c++/4.0.0/iostream:
@@ -387,6 +387,4 @@ TDB.h:
T.h:
stlmacros.h:
../auto.h:

View File

@@ -99,7 +99,7 @@ TDB.o TDB.o: TDB.cpp /usr/include/c++/4.0.0/iostream \
/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 Config.h Table.h color.h \
Grid.h color.h TDB.h T.h stlmacros.h ../auto.h
Grid.h color.h TDB.h T.h ../auto.h
/usr/include/c++/4.0.0/iostream:
@@ -403,6 +403,4 @@ TDB.h:
T.h:
stlmacros.h:
../auto.h:

View File

@@ -96,7 +96,7 @@ Table.o Table.o: Table.cpp /usr/include/c++/4.0.0/iostream \
/usr/include/c++/4.0.0/bits/stl_bvector.h \
/usr/include/c++/4.0.0/bits/vector.tcc color.h Grid.h Date.h task.h \
/usr/include/sys/types.h Config.h Table.h color.h TDB.h T.h T.h \
stlmacros.h ../auto.h
../auto.h
/usr/include/c++/4.0.0/iostream:
@@ -394,6 +394,4 @@ T.h:
T.h:
stlmacros.h:
../auto.h:

View File

@@ -96,7 +96,7 @@ parse.o parse.o: parse.cpp /usr/include/c++/4.0.0/iostream \
/usr/include/c++/4.0.0/bits/stl_map.h \
/usr/include/c++/4.0.0/bits/stl_multimap.h Date.h task.h \
/usr/include/sys/types.h Config.h Table.h color.h Grid.h color.h TDB.h \
T.h stlmacros.h ../auto.h
T.h ../auto.h
/usr/include/c++/4.0.0/iostream:
@@ -390,6 +390,4 @@ TDB.h:
T.h:
stlmacros.h:
../auto.h:

View File

@@ -95,7 +95,7 @@ rules.o rules.o: rules.cpp /usr/include/c++/4.0.0/iostream \
/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 Table.h color.h Grid.h Date.h \
T.h task.h /usr/include/sys/types.h color.h TDB.h stlmacros.h ../auto.h
T.h task.h /usr/include/sys/types.h color.h TDB.h ../auto.h
/usr/include/c++/4.0.0/iostream:
@@ -389,6 +389,4 @@ color.h:
TDB.h:
stlmacros.h:
../auto.h:

View File

@@ -99,7 +99,7 @@ task.o task.o: task.cpp /usr/include/c++/4.0.0/iostream \
/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 Date.h Table.h color.h Grid.h \
stlmacros.h TDB.h T.h task.h color.h ../auto.h /usr/include/ncurses.h \
TDB.h T.h task.h color.h ../auto.h /usr/include/ncurses.h \
/usr/include/ncurses_dll.h /usr/include/unctrl.h /usr/include/curses.h
/usr/include/c++/4.0.0/iostream:
@@ -398,8 +398,6 @@ color.h:
Grid.h:
stlmacros.h:
TDB.h:
T.h:

View File

@@ -95,7 +95,7 @@ text.o text.o: text.cpp /usr/include/c++/4.0.0/iostream \
/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 stlmacros.h ../auto.h
Config.h Table.h color.h Grid.h color.h TDB.h T.h ../auto.h
/usr/include/c++/4.0.0/iostream:
@@ -387,6 +387,4 @@ TDB.h:
T.h:
stlmacros.h:
../auto.h:

View File

@@ -96,8 +96,7 @@ util.o util.o: util.cpp /usr/include/c++/4.0.0/iostream \
/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 color.h Grid.h task.h \
Config.h color.h TDB.h T.h stlmacros.h ../auto.h \
/usr/include/uuid/uuid.h
Config.h color.h TDB.h T.h ../auto.h /usr/include/uuid/uuid.h
/usr/include/c++/4.0.0/iostream:
@@ -391,8 +390,6 @@ TDB.h:
T.h:
stlmacros.h:
../auto.h:
/usr/include/uuid/uuid.h:

View File

@@ -1,6 +1,27 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright 2005 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
@@ -86,6 +107,7 @@ void Config::createDefault (const std::string& file)
if (taskDir != "")
{
// Create a sample .taskrc file.
FILE* out;
if ((out = fopen (file.c_str (), "w")))
{
@@ -104,9 +126,13 @@ void Config::createDefault (const std::string& file)
fprintf (out, "#color.pri.L=on_green\n");
fprintf (out, "color.active=bold_cyan\n");
fprintf (out, "color.tagged=yellow\n");
fprintf (out, "#color.tag.bug=yellow\n");
fprintf (out, "#color.project.home=on_green\n");
fprintf (out, "#color.keyword.car=on_blue\n");
fclose (out);
// Now set the live values.
set ("data.location", taskDir);
set ("command.logging", "off");
set ("confirmation", "yes");

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2005 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_CONFIG

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2005 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
@@ -213,28 +234,28 @@ std::string Date::dayName (int dow)
}
////////////////////////////////////////////////////////////////////////////////
int Date::dayOfWeek ()
int Date::dayOfWeek () const
{
struct tm* t = localtime (&mT);
return t->tm_wday;
}
////////////////////////////////////////////////////////////////////////////////
int Date::month ()
int Date::month () const
{
struct tm* t = localtime (&mT);
return t->tm_mon + 1;
}
////////////////////////////////////////////////////////////////////////////////
int Date::day ()
int Date::day () const
{
struct tm* t = localtime (&mT);
return t->tm_mday;
}
////////////////////////////////////////////////////////////////////////////////
int Date::year ()
int Date::year () const
{
struct tm* t = localtime (&mT);
return t->tm_year + 1900;

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2005 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_DATE
@@ -32,11 +53,11 @@ public:
static std::string monthName (int);
static void dayName (int, std::string&);
static std::string dayName (int);
int dayOfWeek ();
int dayOfWeek () const;
int month ();
int day ();
int year ();
int month () const;
int day () const;
int year () const;
bool operator== (const Date&);
bool operator!= (const Date&);

View File

@@ -1,5 +1,29 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2007 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
//
//
// Grid implements a sparse 2D array of Cell objects. Grid makes every effort
// to perform well on cell insertion and retrieval. A Cell is a variant type,
@@ -145,9 +169,9 @@ unsigned int Grid::height () const
////////////////////////////////////////////////////////////////////////////////
Grid::Cell* Grid::byRow (const unsigned int row, const unsigned int col) const
{
if (row <= mRows.size () &&
if (row < mRows.size () &&
mRows[row] != NULL &&
col <= mRows[row]->size ())
col < mRows[row]->size ())
return (*mRows[row])[col];
return NULL;
@@ -155,9 +179,9 @@ Grid::Cell* Grid::byRow (const unsigned int row, const unsigned int col) const
Grid::Cell* Grid::byColumn (const unsigned int row, const unsigned int col) const
{
if (col <= mColumns.size () &&
if (col < mColumns.size () &&
mColumns[col] != NULL &&
row <= mColumns[col]->size ())
row < mColumns[col]->size ())
return (*mColumns[col])[row];
return NULL;
@@ -166,36 +190,25 @@ Grid::Cell* Grid::byColumn (const unsigned int row, const unsigned int col) cons
////////////////////////////////////////////////////////////////////////////////
void Grid::expandGrid (const unsigned int row, const unsigned int col)
{
// If the new row is outside the bounds of the current grid, add blank rows to
// pad, then a new row vector.
if (row >= mRows.size ())
{
for (unsigned int r = mRows.size (); r <= row; ++r)
if (r < row)
// {
// std::cout << "additional mRows[" << r << "] = NULL" << std::endl;
mRows.push_back (NULL);
// }
else
// {
// std::cout << "additional mRows[" << r << "] = new std::vector <Cell*>" << std::endl;
mRows.push_back (new std::vector <Cell*>);
// }
}
// If the new row is within the bounds of the current grid, ensure that the
// row points to a vector of cells.
else if (mRows[row] == NULL)
// {
// std::cout << "existing mRows[" << row << "] = new std::vector <Cell*>" << std::endl;
mRows[row] = new std::vector <Cell*>;
// }
if (col >= mRows[row]->size ())
for (unsigned int c = mRows[row]->size (); c <= col; ++c)
// {
// std::cout << "additional mRows[" << row << "][" << c << "] = NULL" << std::endl;
mRows[row]->push_back (NULL);
// }
// If the new col is outside the bounds of the current grid, add blank cols to
// pad, then a new col vector.
@@ -203,30 +216,18 @@ void Grid::expandGrid (const unsigned int row, const unsigned int col)
{
for (unsigned int c = mColumns.size (); c <= col; ++c)
if (c < col)
// {
// std::cout << "additional mColumns[" << c << "] = NULL" << std::endl;
mColumns.push_back (NULL);
// }
else
// {
// std::cout << "additional mColumns[" << c << "] = new std::vector <Cell*>" << std::endl;
mColumns.push_back (new std::vector <Cell*>);
// }
}
// If the new col is within the bounds of the current grid, ensure that the
// col points to a vector of cells.
else if (mColumns[col] == NULL)
// {
// std::cout << "existing mColumns[" << col << "] = new std::vector <Cell*>" << std::endl;
mColumns[col] = new std::vector <Cell*>;
// }
if (row >= mColumns[col]->size ())
for (unsigned int r = mColumns[col]->size (); r <= row; ++r)
// {
// std::cout << "additional mColumns[" << col << "][" << r << "] = NULL" << std::endl;
mColumns[col]->push_back (NULL);
// }
}
////////////////////////////////////////////////////////////////////////////////
@@ -237,15 +238,10 @@ void Grid::insertCell (
{
// Delete any existing cell, because cells are owned by rows, not columns.
if ((*mRows[row])[col] != NULL)
// {
// std::cout << "deleted old cell mRows[" << row << "][" << col << "]" << std::endl;
delete (*mRows[row])[col];
// }
(*mRows[row])[col] = cell;
(*mColumns[col])[row] = cell;
// std::cout << "assigned new cell mRows[" << row << "][" << col << "]" << std::endl;
// std::cout << "assigned new cell mColumns[" << col << "][" << row << "]" << std::endl;
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2007 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_GRID

View File

@@ -1,3 +1,3 @@
bin_PROGRAMS = task
task_SOURCES = Config.cpp Date.cpp T.cpp TDB.cpp Table.cpp Grid.cpp color.cpp parse.cpp task.cpp util.cpp text.cpp rules.cpp Config.h Date.h T.h TDB.h Table.h Grid.h color.h stlmacros.h task.h
task_SOURCES = Config.cpp Date.cpp T.cpp TDB.cpp Table.cpp Grid.cpp color.cpp parse.cpp task.cpp util.cpp text.cpp rules.cpp Config.h Date.h T.h TDB.h Table.h Grid.h color.h task.h
AM_CPPFLAGS = -Wall -pedantic -ggdb3 -fno-rtti

View File

@@ -154,7 +154,7 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
task_SOURCES = Config.cpp Date.cpp T.cpp TDB.cpp Table.cpp Grid.cpp color.cpp parse.cpp task.cpp util.cpp text.cpp rules.cpp Config.h Date.h T.h TDB.h Table.h Grid.h color.h stlmacros.h task.h
task_SOURCES = Config.cpp Date.cpp T.cpp TDB.cpp Table.cpp Grid.cpp color.cpp parse.cpp task.cpp util.cpp text.cpp rules.cpp Config.h Date.h T.h TDB.h Table.h Grid.h color.h task.h
AM_CPPFLAGS = -Wall -pedantic -ggdb3 -fno-rtti
all: all-am

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>

23
src/T.h
View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 - 2007, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_T

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2007, 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
@@ -222,7 +243,6 @@ bool TDB::addT (const T& t) const
std::vector <std::string> tags;
task.getTags (tags);
// TODO This logic smells funny.
// +tag or -tag are both considered valid tags to add to a new pending task.
// Generating an error here would not be friendly.
for (unsigned int i = 0; i < tags.size (); ++i)
@@ -307,7 +327,7 @@ bool TDB::logCommand (int argc, char** argv) const
delay (0.25);
#endif
fprintf (out, command.c_str ());
fputs (command.c_str (), out);
fclose (out);
return true;
@@ -342,7 +362,7 @@ bool TDB::overwritePending (std::vector <T>& all) const
std::vector <T>::iterator it;
for (it = all.begin (); it != all.end (); ++it)
fprintf (out, it->compose ().c_str ());
fputs (it->compose ().c_str (), out);
fclose (out);
return true;
@@ -364,7 +384,7 @@ bool TDB::writePending (const T& t) const
delay (0.25);
#endif
fprintf (out, t.compose ().c_str ());
fputs (t.compose ().c_str (), out);
fclose (out);
return true;
@@ -386,7 +406,7 @@ bool TDB::writeCompleted (const T& t) const
delay (0.25);
#endif
fprintf (out, t.compose ().c_str ());
fputs (t.compose ().c_str (), out);
fclose (out);
return true;

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2007, 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_TDB

View File

@@ -1,7 +1,29 @@
////////////////////////////////////////////////////////////////////////////////
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
//
//
// Attributes Table Row Column Cell
// ----------------------------------------------------
@@ -27,7 +49,6 @@
#include <Table.h>
#include <Date.h>
#include <task.h>
#include <stlmacros.h>
////////////////////////////////////////////////////////////////////////////////
Table::Table ()
@@ -632,57 +653,6 @@ void Table::formatCell (
blank = Text::colorize (fg, bg, pad + intraPad);
}
////////////////////////////////////////////////////////////////////////////////
const std::string Table::formatCell (
const int row,
const int col,
const int width,
const int padding)
{
assert (width > 0);
Text::color fg = getFg (row, col);
Text::color bg = getBg (row, col);
just justification = getJustification (row, col);
std::string data = getCell (row, col);
std::string pad = "";
std::string intraPad = "";
std::string preJust = "";
std::string postJust = "";
for (int i = 0; i < padding; ++i)
pad += " ";
// Place the data within the available space - justify.
int gap = width - data.length ();
if (justification == left)
{
for (int i = 0; i < gap; ++i)
postJust += " ";
}
else if (justification == right)
{
for (int i = 0; i < gap; ++i)
preJust += " ";
}
else if (justification == center)
{
for (int i = 0; i < gap / 2; ++i)
preJust += " ";
for (size_t i = 0; i < gap - preJust.length (); ++i)
postJust += " ";
}
if (col < (signed) mColumns.size () - 1)
for (int i = 0; i < getIntraPadding (); ++i)
intraPad += " ";
return Text::colorize (fg, bg, pad + preJust + data + postJust + pad + intraPad);
}
////////////////////////////////////////////////////////////////////////////////
void Table::suppressWS ()
{
@@ -708,10 +678,10 @@ int Table::columnCount ()
// - removal of redundant color codes:
// ^[[31mName^[[0m ^[[31mValue^[[0m -> ^[[31mName Value^[[0m
//
// This method is a work in progress.
void Table::optimize (std::string& output)
{
/*
TODO Unoptimized length.
int start = output.length ();
*/
@@ -724,7 +694,6 @@ void Table::optimize (std::string& output)
}
/*
TODO This code displays the % reduction of the optimize function.
std::cout << int ((100 * (start - output.length ()) / start))
<< "%" << std::endl;
*/

View File

@@ -1,8 +1,28 @@
////////////////////////////////////////////////////////////////////////////////
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// TODO Implement height
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_TABLE
#define INCLUDED_TABLE
@@ -77,7 +97,6 @@ private:
just getJustification (const int, const int);
just getHeaderJustification (const int);
const std::string formatHeader (const int, const int, const int);
const std::string formatCell (const int, const int, const int, const int);
void formatCell (const int, const int, const int, const int, std::vector <std::string>&, std::string&);
void optimize (std::string&);
void sort (std::vector <int>&);

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <string>

View File

@@ -1,7 +1,28 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2008, Paul Beckingham.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_COLOR
#define INCLUDED_COLOR

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
@@ -62,6 +83,7 @@ void initializeColorRules (Config& conf)
void autoColorize (T& task, Text::color& fg, Text::color& bg)
{
// Note: fg, bg already contain colors specifically assigned via command.
// TODO These rules form a hierarchy - the last rule is king.
// Colorization of the tagged.
if (gsFg["color.tagged"] != Text::nocolor ||
@@ -153,6 +175,49 @@ void autoColorize (T& task, Text::color& fg, Text::color& bg)
bg = gsBg["color.due"];
}
}
// Colorization by tag value.
std::map <std::string, Text::color>::iterator it;
for (it = gsFg.begin (); it != gsFg.end (); ++it)
{
if (it->first.substr (0, 10) == "color.tag.")
{
std::string value = it->first.substr (10, std::string::npos);
if (task.hasTag (value))
{
fg = gsFg[it->first];
bg = gsBg[it->first];
}
}
}
// Colorization by project name.
for (it = gsFg.begin (); it != gsFg.end (); ++it)
{
if (it->first.substr (0, 14) == "color.project.")
{
std::string value = it->first.substr (14, std::string::npos);
if (task.getAttribute ("project") == value)
{
fg = gsFg[it->first];
bg = gsBg[it->first];
}
}
}
// Colorization by keyword.
for (it = gsFg.begin (); it != gsFg.end (); ++it)
{
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)
{
fg = gsFg[it->first];
bg = gsBg[it->first];
}
}
}
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -1,18 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 - 2008, Paul Beckingham. All rights reserved.
//
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_STLMACROS
#define INCLUDED_STLMACROS
#define foreach(i, c) \
for (typeof (c) *foreach_p = & (c); \
foreach_p; \
foreach_p = 0) \
for (typeof (foreach_p->begin()) i = foreach_p->begin(); \
i != foreach_p->end(); \
++i)
#endif
////////////////////////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
@@ -16,7 +36,6 @@
#include "Config.h"
#include "Date.h"
#include "Table.h"
#include "stlmacros.h"
#include "TDB.h"
#include "T.h"
#include "task.h"
@@ -256,8 +275,7 @@ int main (int argc, char** argv)
return -2;
}
// return 0;
exit (0);
return 0;
}
////////////////////////////////////////////////////////////////////////////////
@@ -284,7 +302,6 @@ void handleAdd (const TDB& tdb, T& task, Config& conf)
task.setAttribute ("entry", entryTime);
if (task.getDescription () == "")
// std::cout << "Cannot add a blank task" << std::endl;
throw std::string ("Cannot add a blank task.");
if (!tdb.addT (task))
@@ -307,29 +324,35 @@ void handleProjects (const TDB& tdb, T& task, Config& conf)
unique[task.getAttribute ("project")] += 1;
}
// Render a list of project names from the map.
Table table;
table.addColumn ("Project");
table.addColumn ("Tasks");
table.setColumnUnderline (0);
table.setColumnUnderline (1);
table.setColumnJustification (1, Table::right);
foreach (i, unique)
if (unique.size ())
{
int row = table.addRow ();
table.addCell (row, 0, i->first);
table.addCell (row, 1, i->second);
}
// Render a list of project names from the map.
Table table;
table.addColumn ("Project");
table.addColumn ("Tasks");
std::cout << std::endl
<< table.render ()
<< std::endl
<< unique.size ()
<< (unique.size () == 1 ? " project" : " projects")
<< std::endl;
table.setColumnUnderline (0);
table.setColumnUnderline (1);
table.setColumnJustification (1, Table::right);
foreach (i, unique)
{
int row = table.addRow ();
table.addCell (row, 0, i->first);
table.addCell (row, 1, i->second);
}
std::cout << std::endl
<< table.render ()
<< std::endl
<< unique.size ()
<< (unique.size () == 1 ? " project" : " projects")
<< std::endl;
}
else
std::cout << "No projects."
<< std::endl;
}
////////////////////////////////////////////////////////////////////////////////
@@ -384,7 +407,7 @@ void handleList (const TDB& tdb, T& task, Config& conf)
}
#endif
/* int count = */ tdb.gc ();
tdb.gc ();
// Get the pending tasks.
std::vector <T> tasks;
@@ -540,15 +563,6 @@ void handleList (const TDB& tdb, T& task, Config& conf)
else
std::cout << "No matches."
<< std::endl;
/*
if (count)
std::cout << std::endl
<< "[gc: "
<< count
<< " transferred]"
<< std::endl;
*/
}
////////////////////////////////////////////////////////////////////////////////
@@ -568,7 +582,7 @@ void handleSmallList (const TDB& tdb, T& task, Config& conf)
}
#endif
/* int count = */ tdb.gc ();
tdb.gc ();
// Get the pending tasks.
std::vector <T> tasks;
@@ -710,15 +724,6 @@ void handleSmallList (const TDB& tdb, T& task, Config& conf)
else
std::cout << "No matches."
<< std::endl;
/*
if (count)
std::cout << std::endl
<< "[gc: "
<< count
<< " transferred]"
<< std::endl;
*/
}
////////////////////////////////////////////////////////////////////////////////
@@ -737,7 +742,7 @@ void handleCompleted (const TDB& tdb, T& task, Config& conf)
}
#endif
/* int count = */ tdb.gc ();
tdb.gc ();
// Get the pending tasks.
std::vector <T> tasks;
@@ -840,15 +845,6 @@ void handleCompleted (const TDB& tdb, T& task, Config& conf)
else
std::cout << "No matches."
<< std::endl;
/*
if (count)
std::cout << std::endl
<< "[gc: "
<< count
<< " transferred]"
<< std::endl;
*/
}
////////////////////////////////////////////////////////////////////////////////
@@ -1027,7 +1023,7 @@ void handleLongList (const TDB& tdb, T& task, Config& conf)
}
#endif
/* int count = */ tdb.gc ();
tdb.gc ();
// Get all the tasks.
std::vector <T> tasks;
@@ -1207,15 +1203,6 @@ void handleLongList (const TDB& tdb, T& task, Config& conf)
<< std::endl;
else
std::cout << "No matches." << std::endl;
/*
if (count)
std::cout << std::endl
<< "[gc: "
<< count
<< " transferred]"
<< std::endl;
*/
}
////////////////////////////////////////////////////////////////////////////////
@@ -1404,7 +1391,7 @@ void handleReportNext (const TDB& tdb, T& task, Config& conf)
}
#endif
/* int gcCount = */ tdb.gc ();
tdb.gc ();
// Get the pending tasks.
std::vector <T> tasks;
@@ -1560,15 +1547,6 @@ void handleReportNext (const TDB& tdb, T& task, Config& conf)
else
std::cout << "No matches."
<< std::endl;
/*
if (gcCount)
std::cout << std::endl
<< "[gc: "
<< gcCount
<< " transferred]"
<< std::endl;
*/
}
////////////////////////////////////////////////////////////////////////////////
@@ -1818,32 +1796,15 @@ void handleReportUsage (const TDB& tdb, T& task, Config& conf)
}
////////////////////////////////////////////////////////////////////////////////
void handleReportCalendar (const TDB& tdb, T& task, Config& conf)
std::string renderMonth (
int month,
int year,
const Date& today,
std::vector <T>& all,
Config& conf)
{
// Today.
Date date;
int m = date.month ();
int y = date.year ();
int today = date.day ();
// Read all the tasks, filter by those that have a due date.
std::vector <int> annotations;
std::vector <T> pending;
tdb.pendingT (pending);
for (unsigned int i = 0; i < pending.size (); ++i)
{
T task (pending[i]);
if (task.getAttribute ("due") != "")
{
Date d (::atoi (task.getAttribute ("due").c_str ()));
if (d.year () == y && d.month () == m)
annotations.push_back (d.day ());
}
}
pending.clear ();
Table table;
table.addColumn (" ");
table.addColumn ("Su");
table.addColumn ("Mo");
table.addColumn ("Tu");
@@ -1852,13 +1813,13 @@ void handleReportCalendar (const TDB& tdb, T& task, Config& conf)
table.addColumn ("Fr");
table.addColumn ("Sa");
table.setColumnUnderline (0);
table.setColumnUnderline (1);
table.setColumnUnderline (2);
table.setColumnUnderline (3);
table.setColumnUnderline (4);
table.setColumnUnderline (5);
table.setColumnUnderline (6);
table.setColumnUnderline (7);
table.setColumnJustification (0, Table::right);
table.setColumnJustification (1, Table::right);
@@ -1867,25 +1828,35 @@ void handleReportCalendar (const TDB& tdb, T& task, Config& conf)
table.setColumnJustification (4, Table::right);
table.setColumnJustification (5, Table::right);
table.setColumnJustification (6, Table::right);
table.setColumnJustification (7, Table::right);
int days = Date::daysInMonth (m, y);
int days = Date::daysInMonth (month, year);
int row = table.addRow ();
for (int d = 1; d <= days; ++d)
{
Date temp (m, d, y);
Date temp (month, d, year);
int dow = temp.dayOfWeek ();
table.addCell (row, dow, d);
table.addCell (row, dow + 1, d);
if (conf.get ("color", true) && d == today)
table.setCellFg (row, dow, Text::cyan);
if (conf.get ("color", true) &&
today.day () == d &&
today.month () == month &&
today.year () == year)
table.setCellFg (row, dow + 1, Text::cyan);
for (unsigned int a = 0; a < annotations.size (); ++a)
std::vector <T>::iterator it;
for (it = all.begin (); it != all.end (); ++it)
{
if (conf.get ("color", true) && annotations[a] == d)
Date due (::atoi (it->getAttribute ("due").c_str ()));
if (conf.get ("color", true) &&
due.day () == d &&
due.month () == month &&
due.year () == year)
{
table.setCellFg (row, dow, Text::black);
table.setCellBg (row, dow, d < today ? Text::red : Text::yellow);
table.setCellFg (row, dow + 1, Text::black);
table.setCellBg (row, dow + 1, due < today ? Text::on_red : Text::on_yellow);
}
}
@@ -1893,13 +1864,66 @@ void handleReportCalendar (const TDB& tdb, T& task, Config& conf)
row = table.addRow ();
}
std::cout << std::endl
<< Date::monthName (m)
<< " "
<< y
return table.render ();
}
////////////////////////////////////////////////////////////////////////////////
void handleReportCalendar (const TDB& tdb, T& task, Config& conf)
{
// Load all the pending tasks.
std::vector <T> pending;
tdb.pendingT (pending);
// Find the oldest pending due date.
Date oldest;
Date newest;
std::vector <T>::iterator it;
for (it = pending.begin (); it != pending.end (); ++it)
{
if (it->getAttribute ("due") != "")
{
Date d (::atoi (it->getAttribute ("due").c_str ()));
if (d < oldest) oldest = d;
if (d > newest) newest = d;
}
}
// Iterate from oldest due month, year to newest month, year.
Date today;
int mFrom = oldest.month ();
int yFrom = oldest.year ();
int mTo = newest.month ();
int yTo = newest.year ();
std::cout << std::endl;
std::string output;
while (yFrom < yTo || (yFrom == yTo && mFrom <= mTo))
{
std::cout << Date::monthName (mFrom)
<< " "
<< yFrom
<< std::endl
<< std::endl
<< renderMonth (mFrom, yFrom, today, pending, conf)
<< std::endl;
if (++mFrom == 13)
{
mFrom = 1;
++yFrom;
}
}
std::cout << "Legend: "
<< Text::colorize (Text::cyan, Text::nocolor, "today")
<< ", "
<< Text::colorize (Text::black, Text::on_yellow, "due")
<< ", "
<< Text::colorize (Text::black, Text::on_red, "overdue")
<< "."
<< std::endl
<< std::endl
<< table.render ()
<< std::endl;
}
@@ -2187,18 +2211,19 @@ void handleReportStats (const TDB& tdb, T& task, Config& conf)
if (tags.size ()) ++taggedT;
}
// TODO Unused feature list
std::cout << "Pending " << pendingT << std::endl
<< "Completed " << completedT << std::endl
<< "Deleted " << deletedT << std::endl
<< "Total " << totalT << std::endl;
Date e (earliest);
std::cout << "Oldest task " << e.toString () << std::endl;
Date l (latest);
std::cout << "Newest task " << l.toString () << std::endl;
std::cout << "Task used for " << formatSeconds (latest - earliest) << std::endl;
if (tasks.size ())
{
Date e (earliest);
std::cout << "Oldest task " << e.toString () << std::endl;
Date l (latest);
std::cout << "Newest task " << l.toString () << std::endl;
std::cout << "Task used for " << formatSeconds (latest - earliest) << std::endl;
}
if (totalT)
std::cout << "Task added every " << formatSeconds ((latest - earliest) / totalT) << std::endl;
@@ -2245,7 +2270,7 @@ void handleVersion (Config& conf)
table.setColumnUnderline (0);
table.setColumnUnderline (1);
table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, Table::minimum);
table.setColumnWidth (1, Table::flexible);
table.setColumnJustification (0, Table::left);
table.setColumnJustification (1, Table::left);
table.sortOn (0, Table::ascendingCharacter);
@@ -2270,6 +2295,14 @@ 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
<< std::endl
<< std::endl
<< table.render ()
<< std::endl;

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
@@ -13,13 +34,20 @@
#include "color.h"
#include "TDB.h"
#include "T.h"
#include "stlmacros.h"
#include "../auto.h"
#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#endif
#define foreach(i, c) \
for (typeof (c) *foreach_p = & (c); \
foreach_p; \
foreach_p = 0) \
for (typeof (foreach_p->begin()) i = foreach_p->begin(); \
i != foreach_p->end(); \
++i)
// parse.cpp
void parse (std::vector <std::string>&, std::string&, T&);
bool validDate (std::string&);

View File

@@ -1,4 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include "../T.h"

View File

@@ -1,4 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>

View File

@@ -1,11 +1,32 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2007, 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <library.h>
#include <task.h>
static int total = 0;
static int counter = 0;

View File

@@ -1,5 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2007, 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_TEST

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2004 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>

View File

@@ -1,6 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 - 2008, Paul Beckingham. All rights reserved.
// task - a command line task list manager.
//
// Copyright 2006 - 2008, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>