Commits on Jan 24, 2012
  1. @ginatrapani

    Merge pull request #72 from inkarkat/list-optimization2

    Optimization: Put grep -v empty task filter inside sed.
    ginatrapani committed Jan 24, 2012
  2. @ginatrapani

    Merge pull request #71 from inkarkat/deduplicate-and-report

    Deduplicate and report
    ginatrapani committed Jan 24, 2012
Commits on Jan 23, 2012
  1. @inkarkat

    Optimization: Put grep -v empty task filter inside sed.

    No need to spawn off another process for this; we can do this inside the sed command that joins the task numbers with the task text.
    Note: The sed on OS X does not understand the \+ bound, only in the form of + when used with -E. Instead, I chose to fall back to the \{1,\} basic regexp, in the hope that it is very portable, and to avoid introducing extended regexps to the script.
    inkarkat committed Jan 23, 2012
  2. @inkarkat

    FIX: Adapt deduplicate sed command for OS X.

    The sed command of BSD / OS X doesn't like { command } blocks in a single expression. So move the (dynamic) deduplicate sed command(s) to the end, and use a label to access them. This also makes the entire sed script somewhat easier to understand.
    inkarkat committed Jan 23, 2012
Commits on Jan 21, 2012
  1. @inkarkat
  2. @inkarkat

    ENH: Only add new data to report.

    When the last reported values are identical to the current values, do not append the same information (just with a new timestamp) to the report. Instead, just print the last report line.
    With this, the report action can be scheduled periodically (e.g. via cron) without artificially inflating the report file.
    inkarkat committed Jan 14, 2012
  3. @inkarkat

    Align report order with other actions.

    Like "add" or "do", first the object, then (in verbose mode) the status message is printed.
    inkarkat committed Jan 14, 2012
  4. @inkarkat

    Use ISO 8601 timestamp format.

    IMO 2012-01-14T14:49 looks better than the messy -*-*-*- of 2012-01-14-14:49, and is more aligned with standards.
    inkarkat committed Jan 14, 2012
  5. @inkarkat
  6. @inkarkat

    Only print the added report line, not entire report.

    I think this makes much more sense, especially once the report gets very long. (One can always use "cat" to view the entire report.)
    inkarkat committed Jan 14, 2012
  7. @inkarkat

    Remove inactive broken report header.

    This was meant to write a report header on the initial report run, but as it mistakenly used TODO_FILE instead of REPORT_FILE, it was inactive, and also missing in the tests. Let's just remove it; the format is simple, anyway.
    inkarkat committed Jan 14, 2012
  8. @inkarkat

    Pull archive() in-line and delegate via recursive call, also for report.

    The report action should delegate to archive; it previously (half) did this via duplicated code (and forgot to defragment empty lines, so the tally could be off, and kept silent about the archiving).
    The do action directly invoked archive(); if the user had extended / modified the archive action via an eponymous custom action, it would not run. Therefore, always invoke archive through another call of, so that a possible custom action is considered.
    inkarkat committed Jan 13, 2012
  9. @inkarkat
  10. @inkarkat
  11. @inkarkat

    Rework fixed archive deduplication into new deduplicate action.

    As per discussion on the mailing list (, the automatic deduplication during archiving is unexpected and difficult to enforce in other implementations. Rather, make this a separate (optional) action.
    inkarkat committed Jan 13, 2012
  12. @paulroub @inkarkat
  13. @paulroub @inkarkat
Commits on Jan 20, 2012
  1. @jean @ginatrapani

    Various helptext fixes

    * 'Quotes optional.' doesn't make sense for 'addm', because without quotes, 'addm' is 'add'.
    * There are no projects that don't start with a +.
    * Don't tell people to type uppercase when the software takes care of it.
    * Mention actions, mention filtering *out* terms.
    * Fix link to wiki in the README
    Closes #60
    jean committed with ginatrapani Dec 25, 2011
  2. @inkarkat @ginatrapani
  3. @inkarkat @ginatrapani

    Remove task date(s) when completing prioritized and done tasks.

    Replace the primitive substitutions inside the completion function with a call to sed (instead of calling head), and supply more powerful substitutions there.
    inkarkat committed with ginatrapani Jan 9, 2012
  4. @inkarkat @ginatrapani

    Avoid external TR when replacing , with space.

    No need for an external tool, Bash can do a global literal substitution itself.
    inkarkat committed with ginatrapani Jan 7, 2012
  5. @inkarkat @ginatrapani

    Add HIDE_CUSTOM_SUBSTITUTION for customization and add-ons.

    Add-ons or users may want to hide parts of the task text from the output.
    Though this can already be solved through TODOTXT_FINAL_FILTER, augmenting the configured value is not trivial, and it introduces another SED command into the already long _list() pipeline. Putting an additional HIDE_CUSTOM_SUBSTITUTION into the existing pipeline has hardly any performance implications, and makes the realization of this use case trivial.
    inkarkat committed with ginatrapani Jan 7, 2012
  6. @inkarkat @ginatrapani

    BUG: SED error when HIDE_..._SUBSTITUTION contains whitespace.

    This error only occurs when add-ons override either HIDE_PROJECTS_SUBSTITUTION or HIDE_CONTEXTS_SUBSTITUTION with a pattern that contains whitespace, not with the values used within But correcting the sloppy quoting doesn't hurt, neither.
    inkarkat committed with ginatrapani Jan 7, 2012
  7. @inkarkat @ginatrapani

    Add hint for OR'ing TERMs to help text for ls/list.

    The regexp syntax and quoting rules aren't known to many who are not well versed in the Bash shell, and difficult to get right even for people in the know. This question came up just recently on the mailing list, too.
    inkarkat committed with ginatrapani Jan 7, 2012
  8. @inkarkat @ginatrapani
  9. @inkarkat @ginatrapani

    Cosmetics: Consistently use "TERM(s)" in help text.

    Two places only used "TERM" although multiple are supported. This can be misleading: do one or all have to match?
    inkarkat committed with ginatrapani Jan 7, 2012
  10. @inkarkat @ginatrapani

    ENH: listall doesn't simply use concatenated task lists.

    The simplistic "listall" action implementation just uses _list() on the concatenation of active and done task lists. This has the following shortcomings:
    - Task numbers shown for archived tasks from done.txt are invalid.
    - As the number of done tasks likely greatly outnumbers the number of active tasks, the task number padding is often larger than expected (e.g. 0005 instead of 05).
    - Verbose output lists all tasks as originating from TODO, whereas it should differentiate between TODO: and DONE: sources.
    The main challenge is to keep processing all tasks through a single pass of _list(), so that there is a single, unified sorting applied to all tasks. A custom AWK script sets all (originally invalid) task numbers from done.txt to "0", meaning "archived task".
    The verbose message from _list() is replaced with a custom message that shows the tasks from todo.txt, done.txt, and totals.
    Oh, and added tests for the previously untested "listall" action.
    inkarkat committed with ginatrapani Dec 25, 2011
Commits on Dec 23, 2011
  1. @inkarkat

    Reformatting: Lay out _list() file numbering in multi-line. the following complex formatting and filtering steps.
    inkarkat committed Dec 23, 2011
Commits on Dec 19, 2011
  1. @ginatrapani

    Merge pull request #59 from inkarkat/bug-pri-no-existence-check

    BUG: pri doesn't issue an error when the task does not exist.
    ginatrapani committed Dec 19, 2011
Commits on Dec 18, 2011
  1. @inkarkat

    Refactoring: Extract getPrefix() for more consistent move error.

    I think that the error on the "move dest src" action should be given like "SRC: No task 42" instead of "TODO: No task 42 in /path/to/src.txt", to be consistent with the addto and listfile actions. Extracted and exposed getPrefix(), again to remove a bit of duplication, and because this can be useful in custom add-ons, too.
    inkarkat committed Dec 18, 2011
Commits on Dec 17, 2011
  1. @inkarkat

    Refactoring: Extract getTodo() and getNewtodo() functions.

    The retrieval of a task text for $item and associated error handling so far was scattered around the individual actions. This is now consolidated in two new utility functions, which directly set $todo or $newtodo, respectively. (Inconsistent variable names like $NEWTODO have been adapted.) This ensures that all actions perform the same error checking, reduces a bit of duplication, and allows custom add-ons to benefit from these exported functions. Ah, and the error messages for the "move" action is now more in line with the other errors; unfortunately, this isn't yet covered by a test.
    Note that the check whether $item is numeric must not use the +([0-9]) extglob any more, as such functions cannot be exported; a new Bash doesn't have the "shopt -s extglob" and complains with a syntax error. Fortunately, it is possible to perform the same check via standard Bash mechanisms.
    inkarkat committed Dec 17, 2011
  2. @inkarkat
Commits on Dec 7, 2011
  1. @ginatrapani

    Merge pull request #58 from inkarkat/bug-quoting-negative-term

    FIX: Correct quoting for negative -TERM filtering.
    ginatrapani committed Dec 7, 2011
  2. @ginatrapani

    Merge pull request #57 from inkarkat/filename-completion

    Add file completion for addto, listfile, and move.
    ginatrapani committed Dec 7, 2011
  3. @ginatrapani

    Merge pull request #56 from inkarkat/todo_completion

    Incorporate Bash completion from the Wiki page into the distribution.
    ginatrapani committed Dec 7, 2011