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>
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>
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>
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>
The rewrite of ls functionality may have allowed blank but numbered
lines to creep into the ls display. Search for such lines and
exclude them.
Signed-off-by: Emil Sit <sit@emilsit.net>
Signed-off-by: Gina Trapani <ginatrapani@gmail.com>