* 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>
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>
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>
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>
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>
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>