Commit Graph

259 Commits

Author SHA1 Message Date
Philippe Teuwen
cace5eb2d9 Bugfix: TODOTXT_DEFAULT_ACTION was not exported, now exports TODOTXT_*
Simplify the export of TODOTXT variables by having bash construct
the export list dynamically.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-25 20:27:59 -04:00
Philippe Teuwen
701c30c04f test-lib.sh: unset some more TODOTXT env vars for extra safety
While preparing a setup where env vars overload config file,
I had the bad experience that my actual todo.txt was messed up
by the testsuite so it's safer to unset everything.

Even so, some tests could have failed if some TODOTXT_ were set
in the user environment, for example:
export TODOTXT_PLAIN=1
./t1200-pri.sh

Since test-lib.sh does not depend on bash currently, calculate
the list of variables to be unset using set|sed.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-25 20:06:09 -04:00
Philippe Teuwen
2e62536f90 Bugfix: t0000-config test config file was wrong
$TODO_DIR were not protected therefore evaluated to null string
Hopefully it was used only to test for its own presence
but better to fix it in case someone wants to reuse that code

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-20 10:04:45 -04:00
Philippe Teuwen
678283b69e Bugfix: typo in addto help msg skipped name of command
Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-20 10:04:45 -04:00
Philippe Teuwen
c490e773cf test-lib.sh: Fixing grep for date detection on Mac OS X, thanks Dave!
Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-20 10:04:44 -04:00
Dave Hein
a67d0de625 Add TODOTXT_FINAL_FILTER to provide a final custom list filter.
The idea behind this is to allow a config file or addon to inject
a list output filter after all the other filtering has been
performed. The existing TODOTXT_SORT_COMMAND provides a hook
for a custom filter prior to colorization and priority/context/proj
hiding; this new TODOTXT_FINAL_FILTER provides a hook for custom
filtering after the colorization and pri/con/proj hiding.

(I found this hook was needed when I wanted to trim the output to a
maximum line length.)

Note: I've added a number of tests of the list command, including
one for this new variable, as part of this change.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-19 20:30:53 -04:00
Philippe Teuwen
55015f5071 Bugfix: support commands combination for TODOTXT_SORT_COMMAND
So now e.g. piped commands can be used:
export TODOTXT_SORT_COMMAND=" env LC_COLLATE=C sort -f -k2 - | grep -m 10 ."
2009-04-19 20:30:53 -04:00
Philippe Teuwen
c8fc661256 Bugfix: test-lib.sh TEST_DIRECTORY could still contain symlink 2009-04-19 20:30:53 -04:00
Emil Sit
fee3133547 Uniformly use $TODO_SH to refer to script.
Set $TODO_SH to just be $(basename "$0") at the beginning
of the script and use it in all usage messages.

This happens to simplify testing because it allows us to refer to
the script as "todo.sh" in all output.  For general use, if the
user has aliased to file to something else, the usage messages will
still reflect that alias.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-18 21:26:42 -04:00
Emil Sit
825c60514f tests: Factor basic add/list, replace, priority testing out of t9999
add/list and replace are already covered by existing tests.
Add a new test, t1200-pri.sh, that handles the priority tests.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-15 01:28:01 -04:00
ginatrapani
90d113b77d Added wiki front page link 2009-04-14 19:47:52 -07:00
ginatrapani
4caee7d9c0 Consolidated docs under one header 2009-04-14 19:46:30 -07:00
Gina Trapani
fe99926bb2 Added date detection for Macs 2009-04-14 22:37:58 -04:00
Gina Trapani
fd9e2c05a7 Merge branch 'test-framework' of git://github.com/sit/todo.txt-cli into sit/test-framework
* 'test-framework' of git://github.com/sit/todo.txt-cli:
  tests: Update documentation to reflect recent changes.
  tests: add testshell.sh and port old testsuite.txt
  tests: Explicitly control the date for todo.sh.
  tests: Make test writing simpler and add two new tests.
2009-04-13 19:26:06 -04:00
Emil Sit
10bca653a0 tests: Update documentation to reflect recent changes.
Merge Phil's README_generate-test into the main README
and also update the test library documentation to reflect
test_todo_session and test_tick.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-12 10:14:09 -04:00
Philippe Teuwen
d6c57e4230 tests: add testshell.sh and port old testsuite.txt
Add a simple helper script testshell.sh that can be called
to set up an environment for generating test case transcripts
that can then be pasted into an actual test script.

Port old testsuite.txt into t9999-testsuite_example.sh
with the aim of refactoring it later into smaller tests.

Also, change test_todo_session to count from one instead of zero when
autogenerating tests.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-12 10:01:34 -04:00
Gina Trapani
25616bd198 Ported README to Textile 2009-04-12 02:45:54 -04:00
Emil Sit
b238a29430 tests: Explicitly control the date for todo.sh.
Create a custom date view for todo.sh tests -- the time
is set in TODO_TEST_TIME as seconds since the Unix epoch
and a custom wrapper in the testing directory is put at the
front of the path to intercept todo.sh calls to date for
date formatting.

This will only work as long as todo.sh calls $(date) for
date formatting.  It also assumes a date command that
supports the -d flag (such as the one in GNU coreutils.)

Add a test for TODOTXT_DATE_ON_ADD to exercise this functionality.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-11 22:01:31 -04:00
Emil Sit
16a5103668 tests: Make test writing simpler and add two new tests.
Add a test_todo_session function to test-lib.sh that enables
easy recording of input and output from todo.sh (including
annotation of exit status for testing error cases).

Begin to port and re-factor testsuite.txt into smaller
test cases, starting with basic add list functionality
and replace functionality.

Thanks to Philippe Teuwen <phil@teuwen.org> for feedback
and improvements.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-11 22:00:49 -04:00
Philippe Teuwen
4d3b7472ff Bugfix: pri accepted priorities of more than a single letter
e.g. todo.sh pri 1 aa

Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-11 08:20:15 +08:00
Emil Sit
680e93e737 Don't set sort command in default todo.cfg.
Instead of directly setting a value in todo.cfg, let the user
know what the default is and how to customize it.  This allows
developers the flexibility of changing the default in todo.sh
without having to worry about fixing people's config files.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-07 20:34:10 -04:00
Emil Sit
477738828f Don't set colors in default todo.cfg.
Users are probably unlikely to change the definition
of colors like $BLACK so just define them in todo.sh
and comment them out in todo.cfg.  Similarly, leave
default values for priority coloring available but
commented out.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-07 20:34:10 -04:00
Philippe Teuwen
b9f95633dc Cleanup: removing annoying trailing space on pri tasks
Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-08 07:44:41 +08:00
Philippe Teuwen
df1e2eb7cf Cleanup: del/depri/pri: some more $2 -> $item
Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-08 07:36:20 +08:00
Philippe Teuwen
a4e68f9c3f Bugfix: handling of priorities in pri/depri/do: no more globbing
Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-08 07:36:02 +08:00
Gina Trapani
3028de42a8 Bugfix, take 2: depri no longer wipes out entire task with other parens http://tech.groups.yahoo.com/group/todotxt/message/1828 2009-04-07 10:32:16 -07:00
Gina Trapani
8fceae171d Bugfix: depri no longer wipes out entire task with other parens http://tech.groups.yahoo.com/group/todotxt/message/1828 2009-04-07 10:24:06 -07:00
Dave Hein
9898e7df3f Fix misplaced quote that was blocking filename globbing in the action
'usage' logic.

Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-08 00:12:08 +08:00
Dave Hein
42e1a658d6 Add quotes around $action to handle cases where todo.actions.d path includes embedded spaces.
There were a couple places where $action was used without quotes
that caused a problem if the .todo.actions.d had a parent directory
path that included spaces (e.g. /cygdrive/c/Documents\ and\ Settings/jo-user).
This was in the section that calls the addons with the 'usage' arg.

Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-08 00:11:49 +08:00
Philippe Teuwen
f1caecec4e TODO_ACTIONS_D is now TODO_ACTIONS_DIR
Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-07 03:34:33 +08:00
Philippe Teuwen
078c69496f Parametrize .todo.actions.d location
Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-07 03:34:01 +08:00
Gina Trapani
8567a90e4c Bugfix: Replace echoes old todo before new todo. 2009-04-05 10:49:06 -07:00
Philippe Teuwen
55f45e8515 tests: first unset TODOTXT_CFG_FILE
Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-05 06:37:38 +08:00
Gina
03ccc73703 Added missing file required for tests 2009-04-04 14:49:30 -07:00
U-STARBUCK\gina
a822560d44 Added user-facing download link 2009-04-04 12:21:53 -07:00
U-STARBUCK\gina
d860c2c36e Converted tab to spaces 2009-04-04 12:18:57 -07:00
U-STARBUCK\gina
7f954d73ae Merged test and dist Makefile to master branch for easier dev 2009-04-04 12:16:18 -07:00
U-STARBUCK\gina
8e864568a9 Allow custom sort (tx edgewood) 2009-04-02 22:47:50 -07:00
Emil Sit
df4f9150cf Remove gawk and uniq dependencies for listcon, listproj.
Implement listcon and listproj in terms of grep -w -o, which prints
words that match the given regular expression, and sort -u, which
obviates uniq.  This probably only works with GNU grep, which seems
better than having to rely on gawk (which is used nowhere else).

Signed-off-by: Emil Sit <sit@emilsit.net>

Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-03 13:32:20 +08:00
Emil Sit
5cc988102d Misc. whitespace cleanups.
Single space after colon.
No end-of-line whitespace.
Replace tabs with whitespace.

Signed-off-by: Emil Sit <sit@emilsit.net>

Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-03 13:32:20 +08:00
U-STARBUCK\gina
3a0fd43270 Moving Makefile dist infrastructure to a separate branch 2009-04-02 21:49:12 -07:00
U-STARBUCK\gina
1a6ff81e28 Makefile infrastructure v2.3.0 v2.3 2009-04-02 21:01:44 -07:00
Emil Sit
5491e458a2 tests: Simple null test of all list commands
Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-02 21:09:35 -04:00
Emil Sit
5789f5b4c2 Convenience Makefile for running tests inside tests dir.
Simply call up to parent directory where all the real rules
are specified.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-02 21:09:19 -04:00
Emil Sit
b17cb11ec6 Initial test framework and first test.
Add a basic test framework, borrowed from the framework used
by git.git.  A shell script library (tests/test-lib.sh) helps
generate the fixtures, and simplifies the process of writing
test scripts.  Tests can be run as a suite (via 'make test')
or individually (sh tests/t0000-config.sh).  Results are aggregated
upon completion.  Includes a detailed README.

A basic test of config file processing is part of this commit.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-02 21:09:10 -04:00
Emil Sit
0b3d9109de todo.sh: Generate version info at dist time.
When generating the distribution files, prepare todo.sh
by subbing in the current version so that users will
get a proper version number.

Tries to detect VERSION-FILE for running from
the development directory but this doesn't work well
when $PWD is not the top of the git repo.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-02 21:05:58 -04:00
Emil Sit
ad40ef0f18 Basic Makefile and infrastructure to support dist tarballs.
Borrowing slightly from git.git, derive a VERSION-FILE
from the current state of user's git working directory.
The VERSION is derived relative to the latest git annotated
tag object (using git-describe) and includable either in
shell scripts or in Makefiles.

The basic 'make dist' target generates a .tar.gz and a .zip
file named by the detected version.

Also include a basic clean target and dummy test target.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-02 21:05:58 -04:00
Emil Sit
31216fe365 _list: Fix line/item counting, accounting for blank lines.
If a file had blank lines or was totally empty, _list would
result in an in-correct count of total items (either "" or
the number of lines, instead of the number of items).  This
commit splits the filtering into three phases: line numbering,
filtering (optional), and post-processing, and then does
counting separately, if desired.

Signed-off-by: Emil Sit <sit@emilsit.net>

Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-03 07:42:43 +08:00
Emil Sit
7f5c8fb3e1 Add a short help message to be called for -h.
Put the old help message under a "help" command.  The
short help message just lists the available commands and
should fit on a single screen.

Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-03-21 07:20:35 +08:00
Emil Sit
3e7b60abcd Factor out common usage message text.
Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-03-21 07:20:29 +08:00