* Fixed regex in `_list` to exclude lines that begin with whitespace,
as the ' ' => '0' replacement hadn't yet been performed.
* Added test cases to `t1300-ls.sh` to check for this condition.
Using the cleaninput function, to escape &'s on certain actions.
Currently the actions needing escaped &'s are append, prepend and replace.
Other actions including add need unescaped &'s.
This gives access to the full path of the script. It may prove useful
for addon developers to rerun todo.sh from within their addons, in order
to populate variables for context, projects etc. As we have the config
and actions directory available via variables, this is a missing piece.
Commit df4f9150 introduced the use of "grep -w -o". This
combination was broken from the introduction of -o (in 2001) until
subsequent release of GNU grep 2.5.3 in 2007---see changelog for
2005-11-10. In particular, OS X uses a pre-2.5.3 version
of GNU grep.
Work around by replacing with two greps: one to find maximal
strings with @s in them (still relying on -o) and the second to
extract contexts.
Reported by Jon Smajda <jon@smajda.com>; fix developed
in conjunction with Philippe Teuwen <phil@teuwen.org>.
Signed-off-by: Emil Sit <sit@emilsit.net>
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>
$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>
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>
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>
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>
* '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.