Request from exatto (http://article.gmane.org/gmane.comp.diary.todotxt/4699), who doesn't want to use done.txt and report.txt.
Also consider character devices (-c; /dev/null is one) in the file existence checks so that no empty file is then created.
If not found elsewhere, look for the config file in /etc/todo/config.
`make install` installs a global config file, setting TODO_DIR=~/.todo.
todo.sh creates TODO_DIR if it doesn't exist.
The user may need the help to solve any fatal error that appears while todo.sh isn't properly set up. As the help actions do not depend on any setting that the fatal errors check, we can still invoke them.
Factor out dieWithHelp() and use that for printing the fatal errors.
POSIX sed doesn't support regex branches; I don't want to switch to modern regexp (via -E), since that makes more characters special. Rather, expand the alternatives into two sed commands.
Need to make match of preceding priority optional.
Also tighten patterns for priority and done marker by anchoring them to the front, as the leading task number has already been substituted away.
When the command-under-test fails with a non-zero exit code, neither the different exit code nor any output differences are printed. Also, there's a lot of duplication between test_expect_output and test_expect_code_and_output. So, let's fix both by delegating the first to the latter.
Usually (i.e. when a pager is available), the help() output is piped through the pager, and then the return code will be the one of the pager. So the exit 1 at the end of help() doesn't make much sense, and should be abolished for consistency.
Currently, the only way to get usage help for a custom action is to use "todo.sh help" and scroll / search for the action name. (Or try to call the action without / with invalid parameters to hopefully get a one-line syntax summary.)
This extends the help command to print the usage of optionally passed custom action names.
For ls / _list(), custom add-ons can use post_filter_command for additional filtering before the highlighting is applied. Let's allow that for listall and listpri, too, although they employ post_filter_command themselves.
This applies e24777fa2c to todo.cfg, too, and adds a verification to the existing test.
Note: Because todo.cfg is preprocessed by test-lib, we use the original config from the working copy, not the copy inside the test fixture.