Permalink
Commits on Jan 24, 2012
  1. Merge pull request #72 from inkarkat/list-optimization2

    ginatrapani committed Jan 24, 2012
    Optimization: Put grep -v empty task filter inside sed.
  2. Merge pull request #71 from inkarkat/deduplicate-and-report

    ginatrapani committed Jan 24, 2012
    Deduplicate and report
Commits on Jan 23, 2012
  1. Optimization: Put grep -v empty task filter inside sed.

    inkarkat committed Jan 23, 2012
    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.
  2. FIX: Adapt deduplicate sed command for OS X.

    inkarkat committed Jan 23, 2012
    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.
Commits on Jan 21, 2012
  1. ENH: Only add new data to report.

    inkarkat committed Jan 14, 2012
    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.
  2. Align report order with other actions.

    inkarkat committed Jan 14, 2012
    Like "add" or "do", first the object, then (in verbose mode) the status message is printed.
  3. Use ISO 8601 timestamp format.

    inkarkat committed Jan 14, 2012
    IMO 2012-01-14T14:49 looks better than the messy -*-*-*- of 2012-01-14-14:49, and is more aligned with standards.
  4. Only print the added report line, not entire report.

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

    inkarkat committed Jan 14, 2012
    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.
  6. Pull archive() in-line and delegate via recursive call, also for report.

    inkarkat committed Jan 13, 2012
    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 todo.sh, so that a possible custom action is considered.
  7. Rework fixed archive deduplication into new deduplicate action.

    inkarkat committed Jan 13, 2012
    As per discussion on the mailing list (http://tech.groups.yahoo.com/group/todotxt/message/3775), the automatic deduplication during archiving is unexpected and difficult to enforce in other implementations. Rather, make this a separate (optional) action.
Commits on Jan 20, 2012
  1. Various helptext fixes

    jean authored and ginatrapani committed Dec 25, 2011
    * '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
  2. Remove task date(s) when completing prioritized and done tasks.

    inkarkat authored and ginatrapani committed Jan 9, 2012
    Replace the primitive substitutions inside the completion function with a call to sed (instead of calling head), and supply more powerful substitutions there.
  3. Avoid external TR when replacing , with space.

    inkarkat authored and ginatrapani committed Jan 7, 2012
    No need for an external tool, Bash can do a global literal substitution itself.
  4. Add HIDE_CUSTOM_SUBSTITUTION for customization and add-ons.

    inkarkat authored and ginatrapani committed Jan 7, 2012
    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.
  5. BUG: SED error when HIDE_..._SUBSTITUTION contains whitespace.

    inkarkat authored and ginatrapani committed Jan 7, 2012
    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 todo.sh. But correcting the sloppy quoting doesn't hurt, neither.
  6. Add hint for OR'ing TERMs to help text for ls/list.

    inkarkat authored and ginatrapani committed Jan 7, 2012
    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.
  7. Cosmetics: Consistently use "TERM(s)" in help text.

    inkarkat authored and ginatrapani committed Jan 7, 2012
    Two places only used "TERM" although multiple are supported. This can be misleading: do one or all have to match?
  8. ENH: listall doesn't simply use concatenated task lists.

    inkarkat authored and ginatrapani committed Dec 25, 2011
    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.
Commits on Dec 23, 2011
  1. Reformatting: Lay out _list() file numbering in multi-line.

    inkarkat committed Dec 23, 2011
    ...like the following complex formatting and filtering steps.
Commits on Dec 19, 2011
  1. Merge pull request #59 from inkarkat/bug-pri-no-existence-check

    ginatrapani committed Dec 19, 2011
    BUG: pri doesn't issue an error when the task does not exist.
Commits on Dec 18, 2011
  1. Refactoring: Extract getPrefix() for more consistent move error.

    inkarkat committed Dec 18, 2011
    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.
Commits on Dec 17, 2011
  1. Refactoring: Extract getTodo() and getNewtodo() functions.

    inkarkat committed Dec 17, 2011
    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.
Commits on Dec 7, 2011
  1. Merge pull request #58 from inkarkat/bug-quoting-negative-term

    ginatrapani committed Dec 7, 2011
    FIX: Correct quoting for negative -TERM filtering.
  2. Merge pull request #57 from inkarkat/filename-completion

    ginatrapani committed Dec 7, 2011
    Add file completion for addto, listfile, and move.
  3. Merge pull request #56 from inkarkat/todo_completion

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