Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89d4dd74da | ||
|
|
9ff83281c5 | ||
|
|
787b3b4a51 | ||
|
|
74e77e4dc5 | ||
|
|
f73c64801c | ||
|
|
039c3119ff | ||
|
|
fb9f5e2ab3 | ||
|
|
3077c50774 | ||
|
|
0ec24aaef5 | ||
|
|
1a580b1967 | ||
|
|
fd8f63dec6 | ||
|
|
7c9554e8c5 | ||
|
|
f57e22124f | ||
|
|
9aec4efefa | ||
|
|
8a0b8e0328 | ||
|
|
1aa9051885 | ||
|
|
654eb260c7 | ||
|
|
b061ef6191 | ||
|
|
86a9f0f6d5 | ||
|
|
0bf87ed311 | ||
|
|
abc9aa08ec | ||
|
|
a42b8a89c3 | ||
|
|
011ad8fafd | ||
|
|
586883a98d | ||
|
|
40dc0490e1 | ||
|
|
abef040ebc | ||
|
|
cb4f86e9f1 | ||
|
|
b8fc8a0172 | ||
|
|
35dd5df583 | ||
|
|
e666772477 | ||
|
|
6b07f04338 | ||
|
|
334eb45534 | ||
|
|
5e6b256df5 | ||
|
|
e392b8a95e | ||
|
|
18fd59a1ed | ||
|
|
4549af6b84 | ||
|
|
4825b37df5 | ||
|
|
148088c775 | ||
|
|
45a25ca47b | ||
|
|
ab0a57ec89 | ||
|
|
65c2fe438f | ||
|
|
37bdfe06da | ||
|
|
b54b07ef77 | ||
|
|
e3eb87aa74 | ||
|
|
b34cb90709 | ||
|
|
04da56193e | ||
|
|
3e1afc5777 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,7 +1,6 @@
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
conf.defs
|
||||
auto.h*
|
||||
config.h.in
|
||||
config.status
|
||||
|
||||
6
AUTHORS
6
AUTHORS
@@ -0,0 +1,6 @@
|
||||
Principal Author
|
||||
Paul Beckingham, paul@beckingham.net
|
||||
|
||||
Contributing Authors
|
||||
|
||||
|
||||
|
||||
59
COPYING
59
COPYING
@@ -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.
|
||||
|
||||
169
ChangeLog
169
ChangeLog
@@ -1,125 +1,152 @@
|
||||
|
||||
1.0.0 - First official release ()
|
||||
- Bug: assertion fails for task info n, where n is out of range
|
||||
- Bug: assertion fails on mobile for t v
|
||||
|
||||
0.10.0 - Productization ()
|
||||
~ Documentation complete
|
||||
~ Test suite
|
||||
~ All known bugs fixed
|
||||
1.1.0 (?)
|
||||
- Command line specification of alternate .taskrc file
|
||||
|
||||
------ reality -----------------------------------
|
||||
|
||||
0.9.7
|
||||
5/17/2008
|
||||
+ Task offers to create a sample ~/.taskrc file if one is not found.
|
||||
+ Task offers to create a ~/.task directory if one is not found.
|
||||
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.6
|
||||
5/13/208
|
||||
+ Replaced color management code.
|
||||
+ Improved color rules code.
|
||||
0.9.9 (5/27/2008)
|
||||
+ Autoconf/automake behaving properly.
|
||||
+ Clean build on OS X 10.5.
|
||||
+ Clean build on Ubuntu 8.0.
|
||||
+ Clean build on Fedora Core 8.
|
||||
+ Clean build on Fedora Core 9.
|
||||
|
||||
0.9.5
|
||||
5/12/2008
|
||||
+ Replaced Table storage with Grid.
|
||||
5/10/2008
|
||||
+ Added Grid.cpp to configure.ac
|
||||
+ Added Makefile to src/.gitignore
|
||||
+ Makefile should not be part of the repository.
|
||||
+ Added Grid.cpp
|
||||
+ Added Grid::Cell::operator==
|
||||
4/27/2008
|
||||
+ ChangeLog file begun.
|
||||
+ Bumped version to 0.9.5 for next release.
|
||||
0.9.8 (5/25/2008)
|
||||
+ Added "task color" command.
|
||||
+ Removed unnecessary files.
|
||||
+ Completed documentation.
|
||||
|
||||
0.9.4
|
||||
4/26/2008
|
||||
+ Integrated new Grid object into build - not yet integrated into Table.
|
||||
4/19/2008
|
||||
+ More .gitignore tweaks.
|
||||
+ Added .gitignore
|
||||
+ Added more missing files.
|
||||
+ Added all source code.
|
||||
+ Generic OSS files added.
|
||||
+ Initial commit.
|
||||
0.9.7 (5/24/2008)
|
||||
+ Migrated old compiler flags into Makefile.am
|
||||
+ Added ncurses endwin function check to configure.ac
|
||||
+ Set up structure for AUTHORS file.
|
||||
+ Set up NEWS file, with pleas for feedback.
|
||||
+ Added welcome message to README.
|
||||
+ Completed a chunk of the TUTORIAL.
|
||||
+ Added error handling for "task export" when a file name is not specified.
|
||||
+ Task offers to create a sample ~/.taskrc file if one is not found.
|
||||
+ Task offers to create a ~/.task directory if one is not found.
|
||||
+ Removed unnecessary SAMPLE_taskrc, and assorted references.
|
||||
+ Cleaned up ChangeLog.
|
||||
+ Minor mods to standard docs.
|
||||
+ Bumped version to 0.9.7
|
||||
+ Changed some autoconf details
|
||||
+ Corrected comment in T.cpp
|
||||
+ Made unit tests compile and run again.
|
||||
+ Removed tests from distibution.
|
||||
|
||||
0.9.3
|
||||
4/6/2008
|
||||
0.9.6 (5/13/208)
|
||||
+ Corrected wrong include file in Table.cpp
|
||||
+ Replaced color management code.
|
||||
+ Improved color rules code.
|
||||
|
||||
0.9.2
|
||||
4/3/2008
|
||||
0.9.5 (5/12/2008)
|
||||
+ Replaced Table storage with Grid.
|
||||
+ Added Grid.cpp to configure.ac
|
||||
+ Added Makefile to src/.gitignore
|
||||
+ Makefile should not be part of the repository.
|
||||
+ Added Grid.cpp
|
||||
+ Added Grid::Cell::operator==
|
||||
+ ChangeLog file begun.
|
||||
+ Bumped version to 0.9.5 for next release.
|
||||
|
||||
0.9.1
|
||||
4/1/2008
|
||||
0.9.4 (4/26/2008)
|
||||
+ Integrated new Grid object into build - not yet integrated into Table.
|
||||
+ More .gitignore tweaks.
|
||||
+ Added .gitignore
|
||||
+ Added more missing files.
|
||||
+ Added all source code.
|
||||
+ Generic OSS files added.
|
||||
+ Initial commit.
|
||||
|
||||
0.9.0
|
||||
3/23/2008
|
||||
+ flat source directory
|
||||
+ autoconf complete
|
||||
+ "task next"
|
||||
+ "task stats"
|
||||
+ "task export"
|
||||
+ Rule₋based colorization
|
||||
0.9.3 (4/6/2008)
|
||||
+ Added "task completed" command.
|
||||
+ Properly recognizes ncurses.
|
||||
|
||||
0.8.16
|
||||
3/13/208
|
||||
0.9.2 (4/3/2008)
|
||||
+ Recognizes whether ncurses, flock is available.
|
||||
+ "task" duplicated to "task_rel" for preparation of a fork.
|
||||
|
||||
0.8.14
|
||||
2/20/2008
|
||||
0.9.1 (4/1/2008)
|
||||
+ Blank attributes read are longer be written out.
|
||||
+ Completed "task export" command.
|
||||
+ Added configuration values to "task version" command.
|
||||
+ Consolidated header files, removed unnecessary ones.
|
||||
|
||||
0.8.13
|
||||
2/2/2008
|
||||
0.9.0 (3/23/2008)
|
||||
+ flat source directory
|
||||
+ autoconf complete
|
||||
+ "task next"
|
||||
+ "task stats"
|
||||
+ "task export"
|
||||
+ Rules-based colorization
|
||||
|
||||
0.8.1
|
||||
1/28/2008
|
||||
0.8.1 (1/28/2008) - 0.8.16 (3/13/2008)
|
||||
+ autoconf conversion (many builds)
|
||||
|
||||
0.8.0 - Polish (1/25/2008)
|
||||
0.8.0 Polish (1/25/2008)
|
||||
+ Code cleanup, reorganization
|
||||
+ "task overdue"
|
||||
+ Add "age" column to list and long
|
||||
+ Use 'conf' for build, version tracking
|
||||
+ Add "/from/to/" description editing
|
||||
|
||||
0.7.0 - Multi-user, File handling, atomicity (1/8/2008)
|
||||
0.7.0 Multi-user, File handling, atomicity (1/8/2008)
|
||||
+ Clean, publishable API reimplementation
|
||||
+ File locking
|
||||
+ retain deleted tasks
|
||||
+ "task info ID" report showing all metadata
|
||||
|
||||
0.6.0 - Reports (12/27/2006)
|
||||
[Development hiatus while planning for T, TDB API, new features and the future
|
||||
of the project. Seeded to two testers for feedback, suggestions.]
|
||||
|
||||
0.6.0 Reports (12/27/2006)
|
||||
+ "task history"
|
||||
+ "task summary"
|
||||
+ "task calendar"
|
||||
+ due: support
|
||||
+ due support
|
||||
+ Table sorting
|
||||
|
||||
0.5.0 - Multi-user support (12/10/2006)
|
||||
0.5.0 Multi-user support (12/10/2006)
|
||||
+ Command logging
|
||||
+ "task usage" report
|
||||
|
||||
0.4.0 - Destructive / modification commands (12/3/2006)
|
||||
0.4.0 Destructive / modification commands (12/3/2006)
|
||||
+ "task delete" complete
|
||||
+ "task id ..." complete
|
||||
+ "task list ..." synonym for "task find ..."
|
||||
|
||||
0.3.0 - Work in progress support (12/3/2006)
|
||||
0.3.0 Work in progress support (12/3/2006)
|
||||
+ "task start" complete
|
||||
+ "task done" complete
|
||||
+ completed.data support
|
||||
|
||||
0.2.0 - Neutral commands (12/2/2006)
|
||||
0.2.0 Neutral commands (12/2/2006)
|
||||
+ "task find" complete
|
||||
+ "task projects" complete
|
||||
+ "task tags" complete
|
||||
|
||||
0.1.0 - Constructive commands (12/1/2006)
|
||||
0.1.0 Constructive commands (12/1/2006)
|
||||
+ "task add" complete
|
||||
+ completed.data support
|
||||
+ ~/.taskrc support
|
||||
|
||||
0.0.1 - Basic infrastructure (11/29/2006)
|
||||
0.0.1 Basic infrastructure (11/29/2006)
|
||||
+ Command line parsing
|
||||
+ API layer
|
||||
+ Usage
|
||||
|
||||
------ start -----------------------------------
|
||||
|
||||
|
||||
20
DEVELOPERS
Normal file
20
DEVELOPERS
Normal file
@@ -0,0 +1,20 @@
|
||||
Developers may wish to change task, and here is a high-level guide to the files
|
||||
included.
|
||||
|
||||
task.{cpp,h} Functions that implement the task commands, and main.
|
||||
parse.cpp Parses the command line.
|
||||
TDB.{cpp,h} The task database, performs all file I/O
|
||||
T.{cpp,h} Represents a single task - parses a record from TDB, and also
|
||||
composes record for TDB. Provides accessors for tasks.
|
||||
Grid.{cpp,h} Implements a sparse 2D array, provides data storage for the
|
||||
Table object.
|
||||
Table.{cpp,h} Implements tabular data rendering, wrapping etc.
|
||||
Config.{cpp,h} Implements a reader for the .taskrc file.
|
||||
Date.{cpp,h} General date class for the time_t type.
|
||||
text.cpp Text manipulation functions.
|
||||
util.cpp General utility functions.
|
||||
color.cpp Color support functions.
|
||||
rules.cpp Auto-colorization rules.
|
||||
|
||||
Don't forget, please send bugs, patches to task@beckingham.net
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
SUBDIRS = src
|
||||
EXTRA_DIST = TUTORIAL SAMPLE_taskrc
|
||||
EXTRA_DIST = TUTORIAL DEVELOPERS
|
||||
|
||||
|
||||
28
NEWS
28
NEWS
@@ -1,4 +1,30 @@
|
||||
Welcome to Task 1.0.0.
|
||||
|
||||
Task 1.0 is released.
|
||||
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 Hardy Heron
|
||||
- Solaris 10
|
||||
|
||||
While Task has undergone testing, bugs are sure to remain. If you encounter a
|
||||
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 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
|
||||
it takes to recreate the problem. The bug will be addressed, and a new
|
||||
release will be made. You will be a hero.
|
||||
|
||||
- If you are a developer, send a patch that fixes the problem. Your patch
|
||||
will be applied and tested, and a new release will be made. You will be a
|
||||
hero.
|
||||
|
||||
Thank you.
|
||||
|
||||
|
||||
69
README
69
README
@@ -1,47 +1,48 @@
|
||||
|
||||
Thank you
|
||||
GTD
|
||||
Based on ideas in todo.sh
|
||||
Movie at www.b.n/task.mov
|
||||
Feedback, suggestions to task@beckingham.net
|
||||
|
||||
|
||||
|
||||
|
||||
Task - a GTD utility featuring:
|
||||
Thank you for taking a look at task. Task is a GTD utility featuring:
|
||||
|
||||
- Robust C++ implementation
|
||||
- Tags
|
||||
- Colorful, tabular output
|
||||
- Reports
|
||||
- Lots of commands
|
||||
- Low-level API
|
||||
- Auto-completion on all commands, options
|
||||
- Abbreviations for all commands, options
|
||||
- Multi-user file locking
|
||||
- Clean architecture allowing quick addition of new features
|
||||
- UUID for all tasks
|
||||
|
||||
Task is an implementation of GTD ideas, similar to todo.sh, but without many of
|
||||
the limitations in todo.sh, namely:
|
||||
|
||||
- Bugs are not being fixed
|
||||
- No response or web update from ________ on code submission
|
||||
- todo.py is the todo.sh replacement, but requires a python installation - a
|
||||
significant barrier to many users, and is currently merely a
|
||||
reimplementation of todo.sh
|
||||
- project.sh is the natural progression for todo.sh, but is intended to be a
|
||||
project management solution, but is so far todo.sh with a "done" and
|
||||
"overview" command
|
||||
- There is no output formatting
|
||||
- There is no way to enumerate projects, categories
|
||||
- There is no file locking for multi-user access
|
||||
- With no API, a graphical front end must reimplement the primitives
|
||||
|
||||
With a robust infrastructure in place for parsing commands, file I/O and
|
||||
structured output, the development threshold for adding new features is kept
|
||||
low.
|
||||
|
||||
It is intended that features, mainly in the form of reports will be added
|
||||
frequently, with best practices and useful reports evolving.
|
||||
frequently, with best practices and useful reports evolving from usage patterns.
|
||||
|
||||
Task is scope-limited to GTD functionality only.
|
||||
|
||||
You may want to jump straight to the TUTORIAL file, or perhaps watch the old
|
||||
task movie on YouTube:
|
||||
|
||||
http://www.youtube.com/watch?v=l68LCl6BYvs
|
||||
|
||||
or the new improved one:
|
||||
|
||||
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
|
||||
for everyone and some of you may prefer to not proceed. The movie or TUTORIAL
|
||||
file are the quickest way for you to make that decision.
|
||||
|
||||
Task is based on ideas presented in the todo.sh script, found on:
|
||||
|
||||
http://todotxt.org
|
||||
|
||||
Task has a few more features than todo.sh, but fundamentally, they are both
|
||||
working toward the same goals, which is to help you follow basic Getting Things
|
||||
Done (GTD) principles.
|
||||
|
||||
All feedback is welcome, in addition to any bug reports or patches to:
|
||||
|
||||
task@beckingham.net
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
data.location=/home/bob/.task
|
||||
#command.logging=on
|
||||
confirmation=yes
|
||||
nag=Note: try to stick to high priority tasks. See "task next".
|
||||
next=2
|
||||
|
||||
#color.overdue=red
|
||||
#color.due=on yellow
|
||||
#color.pri.H=red
|
||||
#color.pri.M=yellow
|
||||
#color.pri.L=green
|
||||
#color.pri.none=white on yellow
|
||||
#color.active=blue
|
||||
#color.tagged=yellow
|
||||
|
||||
561
TUTORIAL
561
TUTORIAL
@@ -1,9 +1,18 @@
|
||||
Task program tutorial, for version 0.9.0
|
||||
Task program tutorial, for version 1.0.0
|
||||
----------------------------------------
|
||||
|
||||
This guide shows how to quickly set up the task program, and become proficient
|
||||
with it.
|
||||
|
||||
Contents:
|
||||
Quick Setup
|
||||
Simple Usage
|
||||
Advanced Usage
|
||||
Interacting with the Shell
|
||||
Configuring Task
|
||||
Colors
|
||||
|
||||
|
||||
|
||||
Quick Setup
|
||||
-----------
|
||||
@@ -12,32 +21,35 @@ Build the task program according to the directions in the INSTALL file. This
|
||||
transcript illustrates a typical installation:
|
||||
|
||||
% ls
|
||||
task-0.9.0.tar.gz
|
||||
% gunzip task-0.9.0.tar.gz
|
||||
% tar xf task-0.9.0.tar
|
||||
% cd task-0.9.0
|
||||
task-1.0.0.tar.gz
|
||||
% gunzip task-1.0.0.tar.gz
|
||||
% tar xf task-1.0.0.tar
|
||||
% cd task-1.0.0
|
||||
% ./configure
|
||||
...
|
||||
% 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. The next step is to create a configuration file for the
|
||||
task program. This file resides in your home directory, is called .taskrc, and
|
||||
contains various configuration settings. Use the provided SAMPLE_taskrc file
|
||||
as a starting point for your own:
|
||||
environment variable.
|
||||
|
||||
% cp SAMPLE_taskrc ~/.taskrc
|
||||
% mkdir ~/.task
|
||||
Task reads a configuration file - called .taskrc in your home directory - and
|
||||
stores pending and completed tasks in in a directory specified in the
|
||||
configuration file.
|
||||
|
||||
Your .taskrc files contains an entry that points to the .task directory
|
||||
belonging to user bob. Change this entry to point to your own home directory,
|
||||
and the .task directory you just created. Your task program is now ready to
|
||||
use. Verify that task is properly installed with:
|
||||
The simplest way to get a configuration file and task directory is to run task.
|
||||
On startup, task will check to see if it can find the configuration file and
|
||||
task directory, and if not found, will ask you whether it may create both.
|
||||
|
||||
% task version
|
||||
[show sample output]
|
||||
|
||||
A configuration file could not be found in /Users/paul/.taskrc
|
||||
|
||||
Would you like a sample .taskrc created, so task can proceed? (y/n) y
|
||||
Done.
|
||||
|
||||
[then task will show version information]
|
||||
|
||||
|
||||
Simple Usage
|
||||
@@ -70,14 +82,15 @@ task 2:
|
||||
Permanently delete task? (y/n) y
|
||||
|
||||
Task wants you to confirm deletions. To remove the confirmation, edit your
|
||||
.taskrc file and remove the line:
|
||||
.taskrc file and change the line:
|
||||
|
||||
confirmation=yes
|
||||
|
||||
or change the yes to no.
|
||||
to have a value of "no".
|
||||
|
||||
While projects and priorities are not necessary, they can be very useful when
|
||||
the list of tasks grows large. Let's assign a project to these tasks:
|
||||
While the use of projects and priorities are not essential to benefitting from
|
||||
task, they can be very useful when the list of tasks grows large. Let's assign
|
||||
a project to these tasks:
|
||||
|
||||
% task 1 project:Wedding
|
||||
% task 3 project:Wedding
|
||||
@@ -92,9 +105,10 @@ the list of tasks grows large. Let's assign a project to these tasks:
|
||||
Notice that the id numbers have changed. When tasks get deleted, or have their
|
||||
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.
|
||||
|
||||
Now that projects are assigned, we can look at just the Wedding project tasks:
|
||||
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:
|
||||
|
||||
% task ls project:Wedding
|
||||
|
||||
@@ -136,37 +150,44 @@ Priority can be abbreviated to pri, but not pr, because it is ambiguous. Now
|
||||
that tasks have been prioritized, you can see that the tasks are being sorted
|
||||
by priority, with the highest priority tasks at the top.
|
||||
|
||||
These attributes can all be provided when the task is added, instead of
|
||||
applying them afterwards, as shown. The following command shows how to set all
|
||||
the attributes at once:
|
||||
|
||||
% task add project:Wedding priority:H Book plane ticket
|
||||
|
||||
The 'ls' command provides the least information for each task. The 'list'
|
||||
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
|
||||
|
||||
Notice that task can have a due date, and can be active. The task lists are
|
||||
Notice that a task can have a due date, and can be active. The task lists are
|
||||
sorted by due date, then priority. Let's add due dates:
|
||||
|
||||
% task 3 due:3/25/2008
|
||||
% task 1 due:5/31/2008
|
||||
% task 3 due:6/25/2008
|
||||
% task 1 due:7/31/2008
|
||||
% task list
|
||||
|
||||
ID Project Pri Due Active Age Description
|
||||
3 Family H 3/25/2008 6 mins Send John a birthday card
|
||||
1 Wedding H 5/31/2008 7 mins Book plane ticket
|
||||
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
|
||||
|
||||
If today's date is 3/23/2008, then task 3 is due in 2 days. It will be colored
|
||||
If today's date is 6/23/2008, then task 3 is due in 2 days. It will be colored
|
||||
yellow if your terminal supports color. To change this color, edit your
|
||||
.taskrc file, and change the line to one of these alternatives:
|
||||
|
||||
color.due=<foreground color> on <background color>
|
||||
color.due=<foreground color>
|
||||
color.due=on <background color>
|
||||
color.due=red
|
||||
color.due=on_blue
|
||||
color.due=red on_blue
|
||||
color.due=bold_red on_blue
|
||||
|
||||
Where color is one of:
|
||||
Where color is one of the following:
|
||||
|
||||
black
|
||||
blue
|
||||
@@ -178,38 +199,456 @@ Where color is one of:
|
||||
white
|
||||
|
||||
All colors are specified in this way. Take a look in .taskrc for all the other
|
||||
colors you control.
|
||||
color rules that you control.
|
||||
|
||||
Tagging tasks is a good way to group them, aside from specifying a project. To
|
||||
add a tag to a task:
|
||||
|
||||
% task <id> +tag
|
||||
|
||||
The plus sign indicates that this is a tag. Any number of tags may be applied
|
||||
to a task, and then used for searching. Tags are just single words that are
|
||||
labels.
|
||||
|
||||
% task list
|
||||
|
||||
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
|
||||
|
||||
% task 1 +phone
|
||||
% task 2 +phone
|
||||
% task 3 +shopping
|
||||
% task 3 +john
|
||||
|
||||
% task list +phone
|
||||
|
||||
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
|
||||
|
||||
To remove a tag from a task, use the minus sign:
|
||||
|
||||
% task 3 -john
|
||||
|
||||
|
||||
|
||||
Advanced Use
|
||||
------------
|
||||
|
||||
Commands:
|
||||
- task add
|
||||
- task list
|
||||
- task long
|
||||
- task ls
|
||||
- task done
|
||||
- task completed
|
||||
- task delete
|
||||
- task start
|
||||
- task summary
|
||||
- task history
|
||||
- task next
|
||||
- task <modify>
|
||||
- task /from/to/
|
||||
- task projects
|
||||
- task tags
|
||||
- task info
|
||||
- task active
|
||||
- task overdue
|
||||
- task calendar
|
||||
- task stats
|
||||
- task usage
|
||||
- task export
|
||||
- task version
|
||||
Here are the other commands, in some detail. Note that the command:
|
||||
|
||||
% task
|
||||
|
||||
with no arguments will generate a help message that lists all these commands.
|
||||
|
||||
|
||||
% task projects
|
||||
---------------
|
||||
|
||||
This report generates a list of all the different projects that you are using
|
||||
along with a count of the pending tasks for each project. For example:
|
||||
|
||||
% task projects
|
||||
|
||||
Project Tasks
|
||||
Errands 1
|
||||
Birthdays 3
|
||||
Car 2
|
||||
|
||||
|
||||
|
||||
% task summary
|
||||
--------------
|
||||
|
||||
This report lists all the projects and a summary of their task status.
|
||||
|
||||
% task summary
|
||||
|
||||
Project Remaining Avg age Complete 0% 100%
|
||||
Errands 1 3 days 50% XXXXXXXXXXXXXXXX
|
||||
Birthdays 3 7 mths 0%
|
||||
Car 2 2 wks 25% XXXXXXXXX
|
||||
|
||||
This shows the project, the remaining tasks, the average age of each task,
|
||||
the percentage completed (remaining vs total) and a bar indicating that
|
||||
percentage.
|
||||
|
||||
|
||||
|
||||
% task delete <id>
|
||||
------------------
|
||||
|
||||
There are two ways of getting rid of tasks - mark them as done, or delete
|
||||
them.
|
||||
|
||||
|
||||
|
||||
% task done <id>
|
||||
----------------
|
||||
|
||||
This is how a task is marked as done.
|
||||
|
||||
|
||||
|
||||
% task list ...
|
||||
---------------
|
||||
|
||||
The list report will show the active status, and age of the task in addition
|
||||
to the columns that "task ls" shows. It is just a more detailed list.
|
||||
|
||||
|
||||
|
||||
% task long ...
|
||||
---------------
|
||||
|
||||
The long report will show the entry date and start date of a task, in
|
||||
addition to the columns that the "task list" shows.
|
||||
|
||||
|
||||
|
||||
% task start <id>
|
||||
-----------------
|
||||
|
||||
This marks a task as started (and therefore active), which is shown in the
|
||||
"list" report:
|
||||
|
||||
% task list
|
||||
|
||||
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
|
||||
12 Errand L * 3 days Remember to deposit check
|
||||
...
|
||||
|
||||
|
||||
|
||||
% task active
|
||||
-------------
|
||||
|
||||
Shows all active tasks, that is, the tasks for which the "task start ..."
|
||||
command was run, as shown above.
|
||||
|
||||
|
||||
|
||||
% task overdue
|
||||
--------------
|
||||
|
||||
Simply lists all the task that have a due date that is past, in "list"
|
||||
format.
|
||||
|
||||
|
||||
|
||||
% 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
|
||||
|
||||
Year Month Added Completed Deleted Net
|
||||
2008 March 21 16 0 5
|
||||
April 13 11 1 1
|
||||
May 8 14 3 -9
|
||||
|
||||
This shows that for the three months that task has been used, March and April
|
||||
saw the total number of tasks increase, but in May the number decreased as
|
||||
more task were completed than added.
|
||||
|
||||
|
||||
|
||||
% task calendar
|
||||
---------------
|
||||
|
||||
This report shows a calendar of the current month, with any task due or
|
||||
overdue dates marked on it. Color is used to mark these dates.
|
||||
|
||||
% task calendar
|
||||
|
||||
May 2008
|
||||
|
||||
Su Mo Tu We Th Fr Sa
|
||||
1 2 3
|
||||
4 5 6 7 8 9 10
|
||||
11 12 13 14 15 16 17
|
||||
18 19 20 21 22 23 24
|
||||
25 26 27 28 29 30 31
|
||||
|
||||
|
||||
|
||||
% task next
|
||||
-----------
|
||||
|
||||
This report shows you the tasks you should probable work on next. Task will
|
||||
scan all the tasks and will pick two task from each project to report. Those
|
||||
two tasks will be chosen in order of overdue, due soon, High, Medium or Low
|
||||
priority. Essentially task chooses the two most important task for each
|
||||
project and displays them ordered in the usual way.
|
||||
|
||||
If you wish to show a different number of tasks per project, modify the entry
|
||||
in .taskrc:
|
||||
|
||||
next=2
|
||||
|
||||
To be your preferred number.
|
||||
|
||||
|
||||
|
||||
% task <id> ...
|
||||
---------------
|
||||
|
||||
When a task id is specified, everything applies to just that task. Suppose
|
||||
we needed to correct a task:
|
||||
|
||||
% task ls
|
||||
|
||||
ID Project Pri Description
|
||||
12 Errand L Remember to deposit chekc
|
||||
...
|
||||
|
||||
% task 12 Remember to deposit bonus check
|
||||
% task ls
|
||||
|
||||
ID Project Pri Description
|
||||
12 Errand L Remember to deposit bonus check
|
||||
...
|
||||
|
||||
|
||||
|
||||
% task /from/to/
|
||||
----------------
|
||||
|
||||
If a task has been entered with a typo, it can be easily corrected by this
|
||||
command. For example:
|
||||
|
||||
% task ls
|
||||
|
||||
ID Project Pri Description
|
||||
12 Errand L Remember to deposit chekc
|
||||
...
|
||||
|
||||
% task 12 /chekc/check/
|
||||
% task ls
|
||||
|
||||
ID Project Pri Description
|
||||
12 Errand L Remember to deposit check
|
||||
...
|
||||
|
||||
This command makes single corrections to a task description.
|
||||
|
||||
|
||||
|
||||
% task tags
|
||||
-----------
|
||||
|
||||
This command will generate a list of all the tags that are currently in use
|
||||
by task.
|
||||
|
||||
|
||||
|
||||
% task info <id>
|
||||
----------------
|
||||
|
||||
This command gives detailed information about a single task. It will tell
|
||||
you when the task was entered, when started, its status, tags, and more.
|
||||
|
||||
|
||||
|
||||
% task stats
|
||||
------------
|
||||
|
||||
This command generates a list of statistics about your task usage, such as
|
||||
the average time it takes to complete a task, how often new tasks are added,
|
||||
and more.
|
||||
|
||||
|
||||
|
||||
% task completed
|
||||
----------------
|
||||
|
||||
This generates a list of all tasks that have been completed, sorted by their
|
||||
completion date.
|
||||
|
||||
|
||||
|
||||
% task export <file name>
|
||||
-------------------------
|
||||
|
||||
This instructs task to write out a CSV format dump of all tasks, both pending
|
||||
and completed, to the file specified. This is how you might view tasks in a
|
||||
spreadsheet.
|
||||
|
||||
|
||||
|
||||
% task colors
|
||||
-------------
|
||||
|
||||
This command displays all the colors that task supports.
|
||||
|
||||
|
||||
|
||||
% task usage
|
||||
------------
|
||||
|
||||
If logging has been enabled by the "command.logging=on" directive in the
|
||||
.taskrc file, then task will record every command that is run. When this
|
||||
command is run, task will display a count of how many times each command was
|
||||
used.
|
||||
|
||||
This command is for the purpose of seeing whether command are actually used.
|
||||
|
||||
|
||||
|
||||
% task version
|
||||
--------------
|
||||
|
||||
This can be used to show the version number of task, and to display all the
|
||||
current configuration settings, as read from the .taskrc file.
|
||||
|
||||
|
||||
|
||||
Interacting with the Shell
|
||||
--------------------------
|
||||
- Escaping shell metacharacters
|
||||
|
||||
Certain characters are interpreted by the shell. For example, the "&". If
|
||||
you wish to include the & in a task description, you need to escape it, so
|
||||
the shell doesn't interpret it. For example:
|
||||
|
||||
% task add Buy bread & milk
|
||||
|
||||
This command is an error because of the &. The shell will consider this to
|
||||
be two commands:
|
||||
|
||||
% task add Buy bread &
|
||||
% milk
|
||||
|
||||
The shell treats the & character as an indicator that the command is complete
|
||||
and should be run in the background. Then the shell considers "milk" to be a
|
||||
command all by itself. Which it is not. One way to get around this is to
|
||||
individually escape the & character:
|
||||
|
||||
% task add Buy bread \& milk
|
||||
|
||||
Another is to quote the entire description, with either ' or " characters:
|
||||
|
||||
% task add "Buy bread & milk"
|
||||
|
||||
Task itself interprets the commands, and it too can make mistakes. For
|
||||
example, any colon : character will be interpreted by task as a delimiter
|
||||
between an attribute name and its value. Currently there is no workaround
|
||||
for this.
|
||||
|
||||
|
||||
|
||||
% task <id> fg:... bg:...
|
||||
-------------------------
|
||||
|
||||
Not strictly a command, the setting of the fg and bg (foreground and
|
||||
background) attributes determines the colors used to represent the task.
|
||||
Valid foreground colors are:
|
||||
|
||||
Valid background colors are:
|
||||
|
||||
Note that these are not just colors, but combinations of colors and
|
||||
attributes.
|
||||
|
||||
Note also that this capability does depend on whether your terminal program
|
||||
can display these colors.
|
||||
|
||||
|
||||
|
||||
|
||||
Configuring Task
|
||||
----------------
|
||||
|
||||
Task recognizes several entries in the .taskrc file for configuration
|
||||
purposes. Valid entries are of the form:
|
||||
|
||||
name=value
|
||||
|
||||
Valid examples are:
|
||||
|
||||
data.location This is a path to the directory containing all the task
|
||||
files. By default, it is set up to be ~/.task, for
|
||||
example: /Users/paul/.task
|
||||
|
||||
command.logging May be "on" or "off", defaulting to "off". This
|
||||
determines whether task records commands. This is not
|
||||
generally useful, except while developing task.
|
||||
|
||||
confirmation May be "yes" or "no", and determines whether task will
|
||||
ask for confirmation before deleting a task.
|
||||
|
||||
nag This may be a string of text, or blank. It is used as
|
||||
a prompt when a task is completed that is not considered
|
||||
high priority. The "task next" command lists important
|
||||
tasks, and completing one of those does not generate
|
||||
this nagging. Default value is:
|
||||
|
||||
Note: try to stick to high priority tasks.
|
||||
See "task next".
|
||||
|
||||
next Is a number, defaulting to 2, which is the number of
|
||||
tasks for each project that are shown in the "task next"
|
||||
command.
|
||||
|
||||
curses Determines whether task uses ncurses to establish the
|
||||
size of the window you are using, for text wrapping.
|
||||
|
||||
color May be "on" or "off". Determines whether task uses
|
||||
color.
|
||||
|
||||
color.overdue These are the coloration rules. They correspond to a
|
||||
color.due particular attribute of a task, such as it being due, or
|
||||
color.pri.H being active, and specifies the automatic coloring of
|
||||
color.pri.M that task.
|
||||
color.pri.L
|
||||
color.pri.none The value may be one optional foreground color (see
|
||||
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.
|
||||
|
||||
color.project.X Colors any task assigned to project X.
|
||||
|
||||
color.keyword.X Colors any task where the description contains X.
|
||||
|
||||
|
||||
Colors
|
||||
------
|
||||
|
||||
Task supports color in several places. In cases where you may specify a
|
||||
color, a foreground, a background, or a combination foreground and background
|
||||
color may be used. The following are valid foreground colors:
|
||||
|
||||
bold underline bold_underline
|
||||
black bold_black underline_black bold_underline_black
|
||||
red bold_red underline_red bold_underline_red
|
||||
green bold_green underline_green bold_underline_green
|
||||
yellow bold_yellow underline_yellow bold_underline_yellow
|
||||
blue bold_blue underline_blue bold_underline_blue
|
||||
magenta bold_magenta underline_magenta bold_underline_magenta
|
||||
cyan bold_cyan underline_cyan bold_underline_cyan
|
||||
white bold_white underline_white bold_underline_white
|
||||
|
||||
and the following are valid background colors:
|
||||
|
||||
on_black on_bright_black
|
||||
on_red on_bright_red
|
||||
on_green on_bright_green
|
||||
on_yellow on_bright_yellow
|
||||
on_blue on_bright_blue
|
||||
on_magenta on_bright_magenta
|
||||
on_cyan on_bright_cyan
|
||||
on_white on_bright_white
|
||||
|
||||
|
||||
36
announcement.txt
Normal file
36
announcement.txt
Normal 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
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_INIT(task, 0.9.7, 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])
|
||||
#AC_CONFIG_SUBDIRS([src])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CXX
|
||||
@@ -14,8 +13,8 @@ AC_PROG_CC
|
||||
AC_LANG(C++)
|
||||
|
||||
# Checks for libraries.
|
||||
#AC_CHECK_LIB(ncurses, initscr, [LIBS="$LIBS -lncurses" AC_DEFINE([HAVE_NCURSES], [1], [Found ncurses])])
|
||||
AC_CHECK_LIB(ncurses,initscr)
|
||||
AC_CHECK_LIB(ncurses,endwin)
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
105
script.txt
Normal file
105
script.txt
Normal file
@@ -0,0 +1,105 @@
|
||||
Hello, and welcome to this quick demo of the task program.
|
||||
|
||||
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 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 The list is sorted by priority.
|
||||
|
||||
task 2 pri:L
|
||||
task li
|
||||
|
||||
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 or remove tags
|
||||
|
||||
task tags or look at all the tags
|
||||
|
||||
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 Oh that's just nasty - let's get rid of that.
|
||||
task 4 bg:
|
||||
task li
|
||||
task 4 fg:
|
||||
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 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 You can export the tasks to a spreadsheet
|
||||
cat file.csv
|
||||
|
||||
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.
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1,12 +1,34 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include "task.h"
|
||||
#include "Config.h"
|
||||
|
||||
@@ -35,7 +57,7 @@ bool Config::load (const std::string& file)
|
||||
while (getline (in, line))
|
||||
{
|
||||
// Remove comments.
|
||||
unsigned int pound = line.find ("#");
|
||||
size_type pound = line.find ("#");
|
||||
if (pound != std::string::npos)
|
||||
line = line.substr (0, pound);
|
||||
|
||||
@@ -44,7 +66,7 @@ bool Config::load (const std::string& file)
|
||||
// Skip empty lines.
|
||||
if (line.length () > 0)
|
||||
{
|
||||
unsigned int equal = line.find ("=");
|
||||
size_type equal = line.find ("=");
|
||||
if (equal != std::string::npos)
|
||||
{
|
||||
std::string key = trim (line.substr (0, equal), " \t");
|
||||
@@ -85,8 +107,9 @@ void Config::createDefault (const std::string& file)
|
||||
|
||||
if (taskDir != "")
|
||||
{
|
||||
// Create a sample .taskrc file.
|
||||
FILE* out;
|
||||
if (out = fopen (file.c_str (), "w"))
|
||||
if ((out = fopen (file.c_str (), "w")))
|
||||
{
|
||||
fprintf (out, "data.location=%s\n", taskDir.c_str ());
|
||||
fprintf (out, "command.logging=off\n");
|
||||
@@ -96,16 +119,20 @@ void Config::createDefault (const std::string& file)
|
||||
fprintf (out, "curses=on\n");
|
||||
fprintf (out, "color=on\n");
|
||||
|
||||
fprintf (out, "color.overdue=red\n");
|
||||
fprintf (out, "#color.due=on yellow\n");
|
||||
fprintf (out, "color.overdue=bold_red\n");
|
||||
fprintf (out, "#color.due=on_bright_yellow\n");
|
||||
fprintf (out, "#color.pri.H=on_red\n");
|
||||
fprintf (out, "#color.pri.M=on_yellow\n");
|
||||
fprintf (out, "#color.pri.L=on_green\n");
|
||||
fprintf (out, "color.active=cyan\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");
|
||||
|
||||
23
src/Config.h
23
src/Config.h
@@ -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
|
||||
|
||||
43
src/Date.cpp
43
src/Date.cpp
@@ -1,10 +1,33 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include "task.h"
|
||||
#include "Date.h"
|
||||
|
||||
@@ -36,8 +59,8 @@ Date::Date (const int m, const int d, const int y)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Date::Date (const std::string& mdy)
|
||||
{
|
||||
unsigned int firstSlash = mdy.find ("/");
|
||||
unsigned int secondSlash = mdy.find ("/", firstSlash + 1);
|
||||
size_t firstSlash = mdy.find ("/");
|
||||
size_t secondSlash = mdy.find ("/", firstSlash + 1);
|
||||
if (firstSlash != std::string::npos &&
|
||||
secondSlash != std::string::npos)
|
||||
{
|
||||
@@ -155,7 +178,7 @@ int Date::daysInMonth (int month, int year)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Date::monthName (int month)
|
||||
{
|
||||
static char* months[12] =
|
||||
static const char* months[12] =
|
||||
{
|
||||
"January",
|
||||
"February",
|
||||
@@ -179,7 +202,7 @@ std::string Date::monthName (int month)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Date::dayName (int dow, std::string& name)
|
||||
{
|
||||
static char* days[7] =
|
||||
static const char* days[7] =
|
||||
{
|
||||
"Sunday",
|
||||
"Monday",
|
||||
@@ -196,7 +219,7 @@ void Date::dayName (int dow, std::string& name)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Date::dayName (int dow)
|
||||
{
|
||||
static char* days[7] =
|
||||
static const char* days[7] =
|
||||
{
|
||||
"Sunday",
|
||||
"Monday",
|
||||
@@ -211,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;
|
||||
|
||||
31
src/Date.h
31
src/Date.h
@@ -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&);
|
||||
|
||||
68
src/Grid.cpp
68
src/Grid.cpp
@@ -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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -399,6 +395,8 @@ bool Grid::Cell::operator== (const Grid::Cell& rhs) const
|
||||
case CELL_STRING: return mString == rhs.mString ? true : false;
|
||||
default: break; // To prevent warnings.
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -414,6 +412,8 @@ bool Grid::Cell::operator!= (const Grid::Cell& rhs) const
|
||||
case CELL_STRING: return mString != rhs.mString ? true : false;
|
||||
default: break; // To prevent warnings.
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
23
src/Grid.h
23
src/Grid.h
@@ -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
|
||||
|
||||
@@ -1,2 +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
|
||||
|
||||
@@ -154,7 +154,8 @@ 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
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
51
src/T.cpp
51
src/T.cpp
@@ -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>
|
||||
@@ -115,7 +136,7 @@ void T::addTag (const std::string& tag)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void T::addTags (const std::vector <std::string>& tags)
|
||||
{
|
||||
for (unsigned int i = 0; i < tags.size (); ++i)
|
||||
for (size_t i = 0; i < tags.size (); ++i)
|
||||
{
|
||||
if (tags[i].find (' ') != std::string::npos)
|
||||
throw std::string ("T::addTags - tags may not contain spaces");
|
||||
@@ -137,7 +158,7 @@ void T::addTags (const std::vector <std::string>& tags)
|
||||
void T::removeTag (const std::string& tag)
|
||||
{
|
||||
std::vector <std::string> copy;
|
||||
for (unsigned int i = 0; i < mTags.size (); ++i)
|
||||
for (size_t i = 0; i < mTags.size (); ++i)
|
||||
if (mTags[i] != tag)
|
||||
copy.push_back (mTags[i]);
|
||||
|
||||
@@ -242,7 +263,7 @@ const std::string T::compose () const
|
||||
else if (mStatus == deleted) line += "X [";
|
||||
|
||||
// Tags
|
||||
for (unsigned int i = 0; i < mTags.size (); ++i)
|
||||
for (size_t i = 0; i < mTags.size (); ++i)
|
||||
{
|
||||
line += (i > 0 ? " " : "");
|
||||
line += mTags[i];
|
||||
@@ -297,7 +318,7 @@ const std::string T::composeCSV ()
|
||||
|
||||
// Tags
|
||||
line += "'";
|
||||
for (unsigned int i = 0; i < mTags.size (); ++i)
|
||||
for (size_t i = 0; i < mTags.size (); ++i)
|
||||
{
|
||||
line += (i > 0 ? " " : "");
|
||||
line += mTags[i];
|
||||
@@ -364,13 +385,13 @@ void T::parse (const std::string& line)
|
||||
if (line[0] == 'X')
|
||||
setStatus (deleted);
|
||||
|
||||
unsigned int openTagBracket = line.find ("[");
|
||||
unsigned int closeTagBracket = line.find ("]", openTagBracket);
|
||||
size_t openTagBracket = line.find ("[");
|
||||
size_t closeTagBracket = line.find ("]", openTagBracket);
|
||||
if (openTagBracket != std::string::npos &&
|
||||
closeTagBracket != std::string::npos)
|
||||
{
|
||||
unsigned int openAttrBracket = line.find ("[", closeTagBracket);
|
||||
unsigned int closeAttrBracket = line.find ("]", openAttrBracket);
|
||||
size_t openAttrBracket = line.find ("[", closeTagBracket);
|
||||
size_t closeAttrBracket = line.find ("]", openAttrBracket);
|
||||
if (openAttrBracket != std::string::npos &&
|
||||
closeAttrBracket != std::string::npos)
|
||||
{
|
||||
@@ -383,7 +404,7 @@ void T::parse (const std::string& line)
|
||||
openAttrBracket + 1, closeAttrBracket - openAttrBracket - 1);
|
||||
std::vector <std::string> pairs;
|
||||
split (pairs, attributes, ' ');
|
||||
for (unsigned int i = 0; i < pairs.size (); ++i)
|
||||
for (size_t i = 0; i < pairs.size (); ++i)
|
||||
{
|
||||
std::vector <std::string> pair;
|
||||
split (pair, pairs[i], ':');
|
||||
@@ -415,13 +436,13 @@ void T::parse (const std::string& line)
|
||||
: line[37] == 'X' ? deleted
|
||||
: pending;
|
||||
|
||||
unsigned int openTagBracket = line.find ("[");
|
||||
unsigned int closeTagBracket = line.find ("]", openTagBracket);
|
||||
size_t openTagBracket = line.find ("[");
|
||||
size_t closeTagBracket = line.find ("]", openTagBracket);
|
||||
if (openTagBracket != std::string::npos &&
|
||||
closeTagBracket != std::string::npos)
|
||||
{
|
||||
unsigned int openAttrBracket = line.find ("[", closeTagBracket);
|
||||
unsigned int closeAttrBracket = line.find ("]", openAttrBracket);
|
||||
size_t openAttrBracket = line.find ("[", closeTagBracket);
|
||||
size_t closeAttrBracket = line.find ("]", openAttrBracket);
|
||||
if (openAttrBracket != std::string::npos &&
|
||||
closeAttrBracket != std::string::npos)
|
||||
{
|
||||
@@ -434,7 +455,7 @@ void T::parse (const std::string& line)
|
||||
openAttrBracket + 1, closeAttrBracket - openAttrBracket - 1);
|
||||
std::vector <std::string> pairs;
|
||||
split (pairs, attributes, ' ');
|
||||
for (unsigned int i = 0; i < pairs.size (); ++i)
|
||||
for (size_t i = 0; i < pairs.size (); ++i)
|
||||
{
|
||||
std::vector <std::string> pair;
|
||||
split (pair, pairs[i], ':');
|
||||
|
||||
23
src/T.h
23
src/T.h
@@ -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
|
||||
|
||||
33
src/TDB.cpp
33
src/TDB.cpp
@@ -1,12 +1,34 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 <fstream>
|
||||
#include <sys/file.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "task.h"
|
||||
#include "TDB.h"
|
||||
@@ -221,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)
|
||||
@@ -306,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;
|
||||
@@ -341,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;
|
||||
@@ -363,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;
|
||||
@@ -385,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;
|
||||
|
||||
23
src/TDB.h
23
src/TDB.h
@@ -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
|
||||
|
||||
117
src/Table.cpp
117
src/Table.cpp
@@ -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
|
||||
// ----------------------------------------------------
|
||||
@@ -22,10 +44,11 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <Table.h>
|
||||
#include <Date.h>
|
||||
#include <task.h>
|
||||
#include <stlmacros.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Table::Table ()
|
||||
@@ -415,7 +438,7 @@ void Table::calculateColumnWidths ()
|
||||
std::vector <int> ideal = mMaxDataWidth;
|
||||
int width = 0;
|
||||
int countFlexible = 0;
|
||||
for (unsigned int c = 0; c < mColumns.size (); ++c)
|
||||
for (size_t c = 0; c < mColumns.size (); ++c)
|
||||
{
|
||||
if (mSpecifiedWidth[c] == flexible)
|
||||
++countFlexible;
|
||||
@@ -440,7 +463,7 @@ void Table::calculateColumnWidths ()
|
||||
{
|
||||
ideal = mMaxDataWidth;
|
||||
width = 0;
|
||||
for (unsigned int c = 0; c < mColumns.size (); ++c)
|
||||
for (size_t c = 0; c < mColumns.size (); ++c)
|
||||
{
|
||||
if (mSpecifiedWidth[c] > 0)
|
||||
ideal[c] = mSpecifiedWidth[c];
|
||||
@@ -462,7 +485,7 @@ void Table::calculateColumnWidths ()
|
||||
int remainder = available % countFlexible;
|
||||
|
||||
int lastFlexible = mColumns.size () - 1;
|
||||
for (unsigned int c = 0; c < mColumns.size (); ++c)
|
||||
for (size_t c = 0; c < mColumns.size (); ++c)
|
||||
{
|
||||
if (mSpecifiedWidth[c] == flexible)
|
||||
{
|
||||
@@ -476,8 +499,16 @@ void Table::calculateColumnWidths ()
|
||||
mCalculatedWidth = ideal;
|
||||
return;
|
||||
}
|
||||
// else
|
||||
else
|
||||
{
|
||||
// std::cout << "# insufficient room, considering only flexible columns." << std::endl;
|
||||
|
||||
// The fallback position is to assume no width was specificed, and just
|
||||
// calculate widths accordingly.
|
||||
mTableWidth = 0;
|
||||
calculateColumnWidths ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Try again, treating minimum columns as flexible.
|
||||
@@ -585,7 +616,7 @@ void Table::formatCell (
|
||||
std::string postJust;
|
||||
std::vector <std::string> chunks;
|
||||
wrapText (chunks, data, width);
|
||||
for (unsigned int chunk = 0; chunk < chunks.size (); ++chunk)
|
||||
for (size_t chunk = 0; chunk < chunks.size (); ++chunk)
|
||||
{
|
||||
// Place the data within the available space - justify.
|
||||
int gap = width - chunks[chunk].length ();
|
||||
@@ -606,7 +637,7 @@ void Table::formatCell (
|
||||
for (int i = 0; i < gap / 2; ++i)
|
||||
preJust += " ";
|
||||
|
||||
for (unsigned int i = 0; i < gap - preJust.length (); ++i)
|
||||
for (size_t i = 0; i < gap - preJust.length (); ++i)
|
||||
postJust += " ";
|
||||
}
|
||||
|
||||
@@ -622,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 (unsigned int 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 ()
|
||||
{
|
||||
@@ -698,15 +678,15 @@ 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 ();
|
||||
*/
|
||||
|
||||
// \s\n -> \n
|
||||
unsigned int i = 0;
|
||||
size_t i = 0;
|
||||
while ((i = output.find (" \n")) != std::string::npos)
|
||||
{
|
||||
output = output.substr (0, i) +
|
||||
@@ -714,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;
|
||||
*/
|
||||
@@ -749,7 +728,7 @@ void Table::sort (std::vector <int>& order)
|
||||
while (r + gap < (int) order.size ())
|
||||
{
|
||||
bool keepScanning = true;
|
||||
for (unsigned int c = 0; keepScanning && c < mSortColumns.size (); ++c)
|
||||
for (size_t c = 0; keepScanning && c < mSortColumns.size (); ++c)
|
||||
{
|
||||
keepScanning = false;
|
||||
|
||||
@@ -847,8 +826,8 @@ void Table::sort (std::vector <int>& order)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Table::clean (std::string& value)
|
||||
{
|
||||
unsigned int start = 0;
|
||||
unsigned int pos;
|
||||
size_t start = 0;
|
||||
size_t pos;
|
||||
while ((pos = value.find ('\t', start)) != std::string::npos)
|
||||
{
|
||||
value.replace (pos, 1, " ");
|
||||
@@ -876,7 +855,7 @@ const std::string Table::render ()
|
||||
|
||||
// Print column headers in column order.
|
||||
std::string output;
|
||||
for (unsigned int col = 0; col < mColumns.size (); ++col)
|
||||
for (size_t col = 0; col < mColumns.size (); ++col)
|
||||
output += formatHeader (
|
||||
col,
|
||||
mCalculatedWidth[col],
|
||||
@@ -899,8 +878,8 @@ const std::string Table::render ()
|
||||
std::vector <std::vector <std::string> > columns;
|
||||
std::vector <std::string> blanks;
|
||||
|
||||
unsigned int maxHeight = 0;
|
||||
for (unsigned int col = 0; col < mColumns.size (); ++col)
|
||||
size_t maxHeight = 0;
|
||||
for (size_t col = 0; col < mColumns.size (); ++col)
|
||||
{
|
||||
std::vector <std::string> lines;
|
||||
std::string blank;
|
||||
@@ -920,9 +899,9 @@ const std::string Table::render ()
|
||||
|
||||
if (maxHeight)
|
||||
{
|
||||
for (unsigned int lines = 0; lines < maxHeight; ++lines)
|
||||
for (size_t lines = 0; lines < maxHeight; ++lines)
|
||||
{
|
||||
for (unsigned int col = 0; col < mColumns.size (); ++col)
|
||||
for (size_t col = 0; col < mColumns.size (); ++col)
|
||||
if (lines < columns[col].size ())
|
||||
output += columns[col][lines];
|
||||
else
|
||||
|
||||
23
src/Table.h
23
src/Table.h
@@ -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>&);
|
||||
|
||||
@@ -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>
|
||||
|
||||
23
src/color.h
23
src/color.h
@@ -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
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2004 - 2008, Paul Beckingham. All rights reserved.
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef INCLUDED_LIBRARY
|
||||
#define INCLUDED_LIBRARY
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "stlmacros.h"
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
// text.cpp
|
||||
void wrapText (std::vector <std::string>&, const std::string&, const int);
|
||||
std::string trimLeft (const std::string& in, const std::string& t = " ");
|
||||
std::string trimRight (const std::string& in, const std::string& t = " ");
|
||||
std::string trim (const std::string& in, const std::string& t = " ");
|
||||
std::wstring trimLeft (const std::wstring& in, const std::wstring& t = L" "); // UNICODE safe
|
||||
std::wstring trimRight (const std::wstring& in, const std::wstring& t = L" "); // UNICODE safe
|
||||
std::wstring trim (const std::wstring& in, const std::wstring& t = L" "); // UNICODE safe
|
||||
void extractParagraphs (const std::string&, std::vector<std::string>&);
|
||||
void extractLine (std::string&, std::string&, int);
|
||||
void split (std::vector<std::string>&, const std::string&, const char);
|
||||
void split (std::vector<std::string>&, const std::string&, const std::string&);
|
||||
void join (std::string&, const std::string&, const std::vector<std::string>&);
|
||||
std::string commify (const std::string&);
|
||||
std::string lowerCase (const std::string&);
|
||||
|
||||
// misc.cpp
|
||||
void delay (float);
|
||||
|
||||
// list.cpp
|
||||
int autoComplete (const std::string&, const std::vector<std::string>&, std::vector<std::string>&);
|
||||
|
||||
// units.cpp
|
||||
void formatTimeDeltaDays (std::string&, time_t);
|
||||
std::string formatSeconds (time_t);
|
||||
|
||||
// uuid.cpp
|
||||
const std::string uuid ();
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1,9 +1,31 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -13,7 +35,7 @@
|
||||
#include "T.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static char* colors[] =
|
||||
static const char* colors[] =
|
||||
{
|
||||
"bold",
|
||||
"underline",
|
||||
@@ -75,7 +97,7 @@ static char* colors[] =
|
||||
"",
|
||||
};
|
||||
|
||||
static char* attributes[] =
|
||||
static const char* attributes[] =
|
||||
{
|
||||
"project",
|
||||
"priority",
|
||||
@@ -88,11 +110,12 @@ static char* attributes[] =
|
||||
"",
|
||||
};
|
||||
|
||||
static char* commands[] =
|
||||
static const char* commands[] =
|
||||
{
|
||||
"active",
|
||||
"add",
|
||||
"calendar",
|
||||
"colors",
|
||||
"completed",
|
||||
"delete",
|
||||
"done",
|
||||
@@ -114,7 +137,7 @@ static char* commands[] =
|
||||
"",
|
||||
};
|
||||
|
||||
void guess (const std::string& type, char** list, std::string& candidate)
|
||||
void guess (const std::string& type, const char** list, std::string& candidate)
|
||||
{
|
||||
std::vector <std::string> options;
|
||||
for (int i = 0; list[i][0]; ++i)
|
||||
@@ -135,7 +158,7 @@ void guess (const std::string& type, char** list, std::string& candidate)
|
||||
error += " '";
|
||||
error += candidate;
|
||||
error += "' - could be either of ";
|
||||
for (unsigned int i = 0; i < matches.size (); ++i)
|
||||
for (size_t i = 0; i < matches.size (); ++i)
|
||||
{
|
||||
if (i)
|
||||
error += ", ";
|
||||
@@ -164,8 +187,8 @@ static bool isCommand (const std::string& candidate)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool validDate (std::string& date)
|
||||
{
|
||||
unsigned int firstSlash = date.find ("/");
|
||||
unsigned int secondSlash = date.find ("/", firstSlash + 1);
|
||||
size_t firstSlash = date.find ("/");
|
||||
size_t secondSlash = date.find ("/", firstSlash + 1);
|
||||
if (firstSlash != std::string::npos &&
|
||||
secondSlash != std::string::npos)
|
||||
{
|
||||
@@ -235,7 +258,7 @@ static bool validAttribute (std::string& name, std::string& value)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static bool validId (const std::string& input)
|
||||
{
|
||||
for (unsigned int i = 0; i < input.length (); ++i)
|
||||
for (size_t i = 0; i < input.length (); ++i)
|
||||
if (!::isdigit (input[i]))
|
||||
return false;
|
||||
|
||||
@@ -274,13 +297,13 @@ static bool validSubstitution (
|
||||
std::string& from,
|
||||
std::string& to)
|
||||
{
|
||||
unsigned int first = input.find ('/');
|
||||
size_t first = input.find ('/');
|
||||
if (first != std::string::npos)
|
||||
{
|
||||
unsigned int second = input.find ('/', first + 1);
|
||||
size_t second = input.find ('/', first + 1);
|
||||
if (second != std::string::npos)
|
||||
{
|
||||
unsigned int third = input.find ('/', second + 1);
|
||||
size_t third = input.find ('/', second + 1);
|
||||
if (third != std::string::npos)
|
||||
{
|
||||
if (first == 0 &&
|
||||
@@ -317,10 +340,10 @@ void parse (
|
||||
command = "";
|
||||
|
||||
std::string descCandidate = "";
|
||||
for (unsigned int i = 0; i < args.size (); ++i)
|
||||
for (size_t i = 0; i < args.size (); ++i)
|
||||
{
|
||||
std::string arg (args[i]);
|
||||
unsigned int colon; // Pointer to colon in argument.
|
||||
size_t colon; // Pointer to colon in argument.
|
||||
std::string from;
|
||||
std::string to;
|
||||
|
||||
|
||||
@@ -1,9 +1,31 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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>
|
||||
#include <stdlib.h>
|
||||
#include "Config.h"
|
||||
#include "Table.h"
|
||||
#include "Date.h"
|
||||
@@ -60,8 +82,8 @@ void initializeColorRules (Config& conf)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void autoColorize (T& task, Text::color& fg, Text::color& bg)
|
||||
{
|
||||
fg = Text::nocolor;
|
||||
bg = Text::nocolor;
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
441
src/task.cpp
441
src/task.cpp
@@ -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>
|
||||
@@ -9,13 +29,13 @@
|
||||
#include <fstream>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "Config.h"
|
||||
#include "Date.h"
|
||||
#include "Table.h"
|
||||
#include "stlmacros.h"
|
||||
#include "TDB.h"
|
||||
#include "T.h"
|
||||
#include "task.h"
|
||||
@@ -56,32 +76,32 @@ void usage (Config& conf)
|
||||
table.addCell (row, 1, "task");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task add [tags] [attributes] description...");
|
||||
table.addCell (row, 1, "task add [tags] [attrs] desc...");
|
||||
table.addCell (row, 2, "Adds a new task");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task list [tags] [attributes] description...");
|
||||
table.addCell (row, 1, "task list [tags] [attrs] desc...");
|
||||
table.addCell (row, 2, "Lists all tasks matching the specified criteria");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task long [tags] [attributes] description...");
|
||||
table.addCell (row, 1, "task long [tags] [attrs] desc...");
|
||||
table.addCell (row, 2, "Lists all task, all data, matching the specified criteria");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task ls [tags] [attributes] description...");
|
||||
table.addCell (row, 1, "task ls [tags] [attrs] desc...");
|
||||
table.addCell (row, 2, "Minimal listing of all tasks matching the specified criteria");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task completed [tags] [attributes] description...");
|
||||
table.addCell (row, 1, "task completed [tags] [attrs] desc...");
|
||||
table.addCell (row, 2, "Chronological listing of all completed tasks matching the specified criteria");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task ID [tags] [attributes] [description...]");
|
||||
table.addCell (row, 1, "task ID [tags] [attrs] [desc...]");
|
||||
table.addCell (row, 2, "Modifies the existing task with provided arguments");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task ID /from/to/");
|
||||
table.addCell (row, 2, "Perform the substitution on the description, for fixing mistakes");
|
||||
table.addCell (row, 2, "Perform the substitution on the desc, for fixing mistakes");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task delete ID");
|
||||
@@ -143,6 +163,10 @@ void usage (Config& conf)
|
||||
table.addCell (row, 1, "task export");
|
||||
table.addCell (row, 2, "Exports all tasks as a CSV file");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task color");
|
||||
table.addCell (row, 2, "Displays all possible colors");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task version");
|
||||
table.addCell (row, 2, "Shows the task version number");
|
||||
@@ -220,6 +244,7 @@ int main (int argc, char** argv)
|
||||
else if (command == "info") handleInfo (tdb, task, conf);
|
||||
else if (command == "long") handleLongList (tdb, task, conf);
|
||||
else if (command == "ls") handleSmallList (tdb, task, conf);
|
||||
else if (command == "colors") handleColor ( conf);
|
||||
else if (command == "completed") handleCompleted (tdb, task, conf);
|
||||
else if (command == "delete") handleDelete (tdb, task, conf);
|
||||
else if (command == "start") handleStart (tdb, task, conf);
|
||||
@@ -250,8 +275,7 @@ int main (int argc, char** argv)
|
||||
return -2;
|
||||
}
|
||||
|
||||
// return 0;
|
||||
exit (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -278,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))
|
||||
@@ -301,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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -378,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;
|
||||
@@ -534,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;
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -562,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;
|
||||
@@ -704,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;
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -731,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;
|
||||
@@ -834,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;
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1021,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;
|
||||
@@ -1201,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;
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1398,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;
|
||||
@@ -1554,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;
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1689,7 +1673,7 @@ void handleReportHistory (const TDB& tdb, T& task, Config& conf)
|
||||
table.setColumnJustification (4, Table::right);
|
||||
table.setColumnJustification (5, Table::right);
|
||||
|
||||
char *months[] =
|
||||
const char *months[] =
|
||||
{
|
||||
"January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December",
|
||||
@@ -1812,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");
|
||||
@@ -1846,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);
|
||||
@@ -1861,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1887,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;
|
||||
}
|
||||
|
||||
@@ -2138,17 +2168,6 @@ void handleReportOverdue (const TDB& tdb, T& task, Config& conf)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void handleReportStats (const TDB& tdb, T& task, Config& conf)
|
||||
{
|
||||
// Determine window size, and set table accordingly.
|
||||
int width = 80;
|
||||
#ifdef HAVE_LIBNCURSES
|
||||
if (conf.get ("curses", true))
|
||||
{
|
||||
WINDOW* w = initscr ();
|
||||
width = w->_maxx + 1;
|
||||
endwin ();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get all the tasks.
|
||||
std::vector <T> tasks;
|
||||
tdb.allT (tasks);
|
||||
@@ -2192,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;
|
||||
@@ -2250,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);
|
||||
@@ -2275,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;
|
||||
|
||||
@@ -2353,34 +2381,38 @@ void handleDone (const TDB& tdb, T& task, Config& conf)
|
||||
void handleExport (const TDB& tdb, T& task, Config& conf)
|
||||
{
|
||||
std::string file = trim (task.getDescription ());
|
||||
|
||||
std::ofstream out (file.c_str ());
|
||||
if (out.good ())
|
||||
if (file.length () > 0)
|
||||
{
|
||||
out << "'id',"
|
||||
<< "'status',"
|
||||
<< "'tags',"
|
||||
<< "'entry',"
|
||||
<< "'start',"
|
||||
<< "'due',"
|
||||
<< "'end',"
|
||||
<< "'project',"
|
||||
<< "'priority',"
|
||||
<< "'fg',"
|
||||
<< "'bg',"
|
||||
<< "'description'"
|
||||
<< "\n";
|
||||
|
||||
std::vector <T> all;
|
||||
tdb.allT (all);
|
||||
foreach (t, all)
|
||||
std::ofstream out (file.c_str ());
|
||||
if (out.good ())
|
||||
{
|
||||
out << t->composeCSV ().c_str ();
|
||||
out << "'id',"
|
||||
<< "'status',"
|
||||
<< "'tags',"
|
||||
<< "'entry',"
|
||||
<< "'start',"
|
||||
<< "'due',"
|
||||
<< "'end',"
|
||||
<< "'project',"
|
||||
<< "'priority',"
|
||||
<< "'fg',"
|
||||
<< "'bg',"
|
||||
<< "'description'"
|
||||
<< "\n";
|
||||
|
||||
std::vector <T> all;
|
||||
tdb.allT (all);
|
||||
foreach (t, all)
|
||||
{
|
||||
out << t->composeCSV ().c_str ();
|
||||
}
|
||||
out.close ();
|
||||
}
|
||||
out.close ();
|
||||
else
|
||||
throw std::string ("Could not write to export file.");
|
||||
}
|
||||
else
|
||||
throw std::string ("Could not write to export file.");
|
||||
throw std::string ("You must specify a file to write to.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -2449,7 +2481,7 @@ void handleModify (const TDB& tdb, T& task, Config& conf)
|
||||
if (from != "")
|
||||
{
|
||||
std::string description = original.getDescription ();
|
||||
unsigned int pattern = description.find (from);
|
||||
size_t pattern = description.find (from);
|
||||
if (pattern != std::string::npos)
|
||||
{
|
||||
description = description.substr (0, pattern) +
|
||||
@@ -2473,6 +2505,83 @@ void handleModify (const TDB& tdb, T& task, Config& conf)
|
||||
throw std::string ("Task not found.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void handleColor (Config& conf)
|
||||
{
|
||||
std::cout << std::endl << "Foreground" << std::endl
|
||||
<< " "
|
||||
<< Text::colorize (Text::bold, Text::nocolor, "bold") << " "
|
||||
<< Text::colorize (Text::underline, Text::nocolor, "underline") << " "
|
||||
<< Text::colorize (Text::bold_underline, Text::nocolor, "bold_underline") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::black, Text::nocolor, "black") << " "
|
||||
<< Text::colorize (Text::bold_black, Text::nocolor, "bold_black") << " "
|
||||
<< Text::colorize (Text::underline_black, Text::nocolor, "underline_black") << " "
|
||||
<< Text::colorize (Text::bold_underline_black, Text::nocolor, "bold_underline_black") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::red, Text::nocolor, "red") << " "
|
||||
<< Text::colorize (Text::bold_red, Text::nocolor, "bold_red") << " "
|
||||
<< Text::colorize (Text::underline_red, Text::nocolor, "underline_red") << " "
|
||||
<< Text::colorize (Text::bold_underline_red, Text::nocolor, "bold_underline_red") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::green, Text::nocolor, "green") << " "
|
||||
<< Text::colorize (Text::bold_green, Text::nocolor, "bold_green") << " "
|
||||
<< Text::colorize (Text::underline_green, Text::nocolor, "underline_green") << " "
|
||||
<< Text::colorize (Text::bold_underline_green, Text::nocolor, "bold_underline_green") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::yellow, Text::nocolor, "yellow") << " "
|
||||
<< Text::colorize (Text::bold_yellow, Text::nocolor, "bold_yellow") << " "
|
||||
<< Text::colorize (Text::underline_yellow, Text::nocolor, "underline_yellow") << " "
|
||||
<< Text::colorize (Text::bold_underline_yellow, Text::nocolor, "bold_underline_yellow") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::blue, Text::nocolor, "blue") << " "
|
||||
<< Text::colorize (Text::bold_blue, Text::nocolor, "bold_blue") << " "
|
||||
<< Text::colorize (Text::underline_blue, Text::nocolor, "underline_blue") << " "
|
||||
<< Text::colorize (Text::bold_underline_blue, Text::nocolor, "bold_underline_blue") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::magenta, Text::nocolor, "magenta") << " "
|
||||
<< Text::colorize (Text::bold_magenta, Text::nocolor, "bold_magenta") << " "
|
||||
<< Text::colorize (Text::underline_magenta, Text::nocolor, "underline_magenta") << " "
|
||||
<< Text::colorize (Text::bold_underline_magenta, Text::nocolor, "bold_underline_magenta") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::cyan, Text::nocolor, "cyan") << " "
|
||||
<< Text::colorize (Text::bold_cyan, Text::nocolor, "bold_cyan") << " "
|
||||
<< Text::colorize (Text::underline_cyan, Text::nocolor, "underline_cyan") << " "
|
||||
<< Text::colorize (Text::bold_underline_cyan, Text::nocolor, "bold_underline_cyan") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::white, Text::nocolor, "white") << " "
|
||||
<< Text::colorize (Text::bold_white, Text::nocolor, "bold_white") << " "
|
||||
<< Text::colorize (Text::underline_white, Text::nocolor, "underline_white") << " "
|
||||
<< Text::colorize (Text::bold_underline_white, Text::nocolor, "bold_underline_white") << std::endl
|
||||
|
||||
<< std::endl << "Background" << std::endl
|
||||
<< " " << Text::colorize (Text::nocolor, Text::on_black, "on_black") << " "
|
||||
<< Text::colorize (Text::nocolor, Text::on_bright_black, "on_bright_black") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::nocolor, Text::on_red, "on_red") << " "
|
||||
<< Text::colorize (Text::nocolor, Text::on_bright_red, "on_bright_red") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::nocolor, Text::on_green, "on_green") << " "
|
||||
<< Text::colorize (Text::nocolor, Text::on_bright_green, "on_bright_green") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::nocolor, Text::on_yellow, "on_yellow") << " "
|
||||
<< Text::colorize (Text::nocolor, Text::on_bright_yellow, "on_bright_yellow") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::nocolor, Text::on_blue, "on_blue") << " "
|
||||
<< Text::colorize (Text::nocolor, Text::on_bright_blue, "on_bright_blue") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::nocolor, Text::on_magenta, "on_magenta") << " "
|
||||
<< Text::colorize (Text::nocolor, Text::on_bright_magenta, "on_bright_magenta") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::nocolor, Text::on_cyan, "on_cyan") << " "
|
||||
<< Text::colorize (Text::nocolor, Text::on_bright_cyan, "on_bright_cyan") << std::endl
|
||||
|
||||
<< " " << Text::colorize (Text::nocolor, Text::on_white, "on_white") << " "
|
||||
<< Text::colorize (Text::nocolor, Text::on_bright_white, "on_bright_white") << std::endl
|
||||
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void gatherNextTasks (
|
||||
const TDB& tdb,
|
||||
|
||||
36
src/task.h
36
src/task.h
@@ -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&);
|
||||
@@ -47,6 +75,7 @@ void handleDelete (const TDB&, T&, Config&);
|
||||
void handleStart (const TDB&, T&, Config&);
|
||||
void handleDone (const TDB&, T&, Config&);
|
||||
void handleModify (const TDB&, T&, Config&);
|
||||
void handleColor (Config&);
|
||||
void gatherNextTasks (const TDB&, T&, Config&, std::vector <T>&, std::vector <int>&);
|
||||
void nag (const TDB&, T&, Config&);
|
||||
|
||||
@@ -56,9 +85,6 @@ void wrapText (std::vector <std::string>&, const std::string&, const int);
|
||||
std::string trimLeft (const std::string& in, const std::string& t = " ");
|
||||
std::string trimRight (const std::string& in, const std::string& t = " ");
|
||||
std::string trim (const std::string& in, const std::string& t = " ");
|
||||
std::wstring trimLeft (const std::wstring& in, const std::wstring& t = L" "); // UNICODE safe
|
||||
std::wstring trimRight (const std::wstring& in, const std::wstring& t = L" "); // UNICODE safe
|
||||
std::wstring trim (const std::wstring& in, const std::wstring& t = L" "); // UNICODE safe
|
||||
void extractParagraphs (const std::string&, std::vector<std::string>&);
|
||||
void extractLine (std::string&, std::string&, int);
|
||||
void split (std::vector<std::string>&, const std::string&, const char);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
62
src/text.cpp
62
src/text.cpp
@@ -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>
|
||||
@@ -76,8 +97,8 @@ void extractParagraphs (const std::string& input, std::vector<std::string>& outp
|
||||
std::string copy = input;
|
||||
while (1)
|
||||
{
|
||||
unsigned int so = copy.find ("<p>");
|
||||
unsigned int eo = copy.find ("</p>");
|
||||
size_t so = copy.find ("<p>");
|
||||
size_t eo = copy.find ("</p>");
|
||||
|
||||
if (so == std::string::npos && eo == std::string::npos)
|
||||
break;
|
||||
@@ -99,13 +120,6 @@ std::string trimLeft (const std::string& in, const std::string& t /*= " "*/)
|
||||
return out.erase (0, in.find_first_not_of (t));
|
||||
}
|
||||
|
||||
// UNICODE safe
|
||||
std::wstring trimLeft (const std::wstring& in, const std::wstring& t /*= L" "*/)
|
||||
{
|
||||
std::wstring out = in;
|
||||
return out.erase (0, in.find_first_not_of (t));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string trimRight (const std::string& in, const std::string& t /*= " "*/)
|
||||
{
|
||||
@@ -113,13 +127,6 @@ std::string trimRight (const std::string& in, const std::string& t /*= " "*/)
|
||||
return out.erase (out.find_last_not_of (t) + 1);
|
||||
}
|
||||
|
||||
// UNICODE safe
|
||||
std::wstring trimRight (const std::wstring& in, const std::wstring& t /*= L" "*/)
|
||||
{
|
||||
std::wstring out = in;
|
||||
return out.erase (out.find_last_not_of (t) + 1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string trim (const std::string& in, const std::string& t /*= " "*/)
|
||||
{
|
||||
@@ -127,13 +134,6 @@ std::string trim (const std::string& in, const std::string& t /*= " "*/)
|
||||
return trimLeft (trimRight (out, t), t);
|
||||
}
|
||||
|
||||
// UNICODE safe
|
||||
std::wstring trim (const std::wstring& in, const std::wstring& t /*= L" "*/)
|
||||
{
|
||||
std::wstring out = in;
|
||||
return trimLeft (trimRight (out, t), t);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Remove enclosing balanced quotes. Assumes trimmed text.
|
||||
void unquoteText (std::string& text)
|
||||
@@ -147,7 +147,7 @@ void unquoteText (std::string& text)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void extractLine (std::string& text, std::string& line, int length)
|
||||
{
|
||||
unsigned int eol = text.find ("\n");
|
||||
size_t eol = text.find ("\n");
|
||||
|
||||
// Special case: found \n in first length characters.
|
||||
if (eol != std::string::npos && eol < (unsigned) length)
|
||||
@@ -183,8 +183,16 @@ void extractLine (std::string& text, std::string& line, int length)
|
||||
// If no space was found, hyphenate.
|
||||
else
|
||||
{
|
||||
line = text.substr (0, length - 1) + "-";
|
||||
text = text.substr (length - 1, std::string::npos);
|
||||
if (length > 1)
|
||||
{
|
||||
line = text.substr (0, length - 1) + "-";
|
||||
text = text.substr (length - 1, std::string::npos);
|
||||
}
|
||||
else
|
||||
{
|
||||
line = text.substr (0, 1);
|
||||
text = text.substr (length, std::string::npos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
24
src/util.cpp
24
src/util.cpp
@@ -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>
|
||||
@@ -10,6 +31,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "Table.h"
|
||||
#include "task.h"
|
||||
#include "../auto.h"
|
||||
|
||||
Reference in New Issue
Block a user