Commit Graph

178 Commits

Author SHA1 Message Date
Gina Trapani
8567a90e4c Bugfix: Replace echoes old todo before new todo. 2009-04-05 10:49:06 -07:00
Philippe Teuwen
55f45e8515 tests: first unset TODOTXT_CFG_FILE
Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-04-05 06:37:38 +08:00
Gina
03ccc73703 Added missing file required for tests 2009-04-04 14:49:30 -07:00
U-STARBUCK\gina
a822560d44 Added user-facing download link 2009-04-04 12:21:53 -07:00
U-STARBUCK\gina
d860c2c36e Converted tab to spaces 2009-04-04 12:18:57 -07:00
U-STARBUCK\gina
7f954d73ae Merged test and dist Makefile to master branch for easier dev 2009-04-04 12:16:18 -07:00
U-STARBUCK\gina
8e864568a9 Allow custom sort (tx edgewood) 2009-04-02 22:47:50 -07:00
Emil Sit
df4f9150cf Remove gawk and uniq dependencies for listcon, listproj.
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>
2009-04-03 13:32:20 +08:00
Emil Sit
5cc988102d Misc. whitespace cleanups.
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>
2009-04-03 13:32:20 +08:00
U-STARBUCK\gina
3a0fd43270 Moving Makefile dist infrastructure to a separate branch 2009-04-02 21:49:12 -07:00
U-STARBUCK\gina
1a6ff81e28 Makefile infrastructure v2.3.0 v2.3 2009-04-02 21:01:44 -07:00
Emil Sit
5491e458a2 tests: Simple null test of all list commands
Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-02 21:09:35 -04:00
Emil Sit
5789f5b4c2 Convenience Makefile for running tests inside tests dir.
Simply call up to parent directory where all the real rules
are specified.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-02 21:09:19 -04:00
Emil Sit
b17cb11ec6 Initial test framework and first test.
Add a basic test framework, borrowed from the framework used
by git.git.  A shell script library (tests/test-lib.sh) helps
generate the fixtures, and simplifies the process of writing
test scripts.  Tests can be run as a suite (via 'make test')
or individually (sh tests/t0000-config.sh).  Results are aggregated
upon completion.  Includes a detailed README.

A basic test of config file processing is part of this commit.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-02 21:09:10 -04:00
Emil Sit
0b3d9109de todo.sh: Generate version info at dist time.
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>
2009-04-02 21:05:58 -04:00
Emil Sit
ad40ef0f18 Basic Makefile and infrastructure to support dist tarballs.
Borrowing slightly from git.git, derive a VERSION-FILE
from the current state of user's git working directory.
The VERSION is derived relative to the latest git annotated
tag object (using git-describe) and includable either in
shell scripts or in Makefiles.

The basic 'make dist' target generates a .tar.gz and a .zip
file named by the detected version.

Also include a basic clean target and dummy test target.

Signed-off-by: Emil Sit <sit@emilsit.net>
2009-04-02 21:05:58 -04:00
Emil Sit
31216fe365 _list: Fix line/item counting, accounting for blank lines.
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>
2009-04-03 07:42:43 +08:00
Emil Sit
7f5c8fb3e1 Add a short help message to be called for -h.
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>
2009-03-21 07:20:35 +08:00
Emil Sit
3e7b60abcd Factor out common usage message text.
Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-03-21 07:20:29 +08:00
Emil Sit
cc3e5f73aa _list: Add in an extra filter to remove empty lines.
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>
2009-03-21 07:20:28 +08:00
Gina Trapani
52604ebf78 Tweaked version and contributor details 2009-03-19 18:52:47 -07:00
Gina Trapani
bbe153b9bb Merge branch 'harding/master' 2009-03-19 18:40:10 -07:00
Gina Trapani
ec54a032cb Removed edit action 2009-03-19 18:37:36 -07:00
David A. Harding
758cdc5551 Merge branch 'gina/master' 2009-03-19 07:10:09 -04:00
David A. Harding
02dc030225 Putting Quotes Around $TODO_TMP
Suggested by Gina.
2009-03-19 07:06:07 -04:00
David A. Harding
7b769b2eea s/[A-Z]/[[:upper:]]/ 2009-03-17 19:15:27 -04:00
David A. Harding
39ee9ab045 Added -vv For Debugging Output 2009-03-17 14:07:48 -04:00
Gina Trapani
1e5902d0e2 Merge branch 'master' of git@github.com:ginatrapani/todo.txt-cli 2009-03-16 12:28:34 -05:00
Matt Brubeck
3df7497287 Add TODOTXT_DEFAULT_ACTION variable.
I like to set this to "ls" so I can just run "todo.sh" (or "t") to list my
tasks.

Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
2009-03-17 01:04:20 +08:00
David A. Harding
07bb979d43 Move Filter Command Up & Remove Extra Sort Command 2009-03-14 15:06:53 -04:00
Ed Blackman
7e04849a4f Move filter before priority text changes, so filter doesn't match invisible text 2009-03-14 13:39:27 -04:00
David A. Harding
f8b2646b92 Don't Echo Empty Lines & Streamline Sed wc -l Syntax 2009-03-14 09:35:10 -04:00
Ed Blackman
02980ae7ee Fix "post_hilter_command" typo 2009-03-14 01:18:42 -04:00
Ed Blackman
12bbf8fe67 Fix spacing (tabs to spaces) 2009-03-14 01:17:46 -04:00
Ed Blackman
ab78607506 Use sed line counting to replace 'wc -l' 2009-03-14 01:15:52 -04:00
David A. Harding
6be78ca5fa Added Exclusion Syntax by Jacobo de Vera
-keyword or -"key phrase" should exclude those terms from the output.
2009-03-13 22:21:48 -04:00
Ed Blackman
9ab77253db Implement pre and post filters in _list 2009-03-13 18:17:16 -04:00
Ed Blackman
cf3c5312bf Export _list for call by extensions 2009-03-13 17:02:31 -04:00
Ed Blackman
37a7bb0e8a Use relative rather than absolute filename in status message 2009-03-13 16:40:55 -04:00
Ed Blackman
ed8e8e24d9 Consistent spacing for \ continuation in _list 2009-03-13 16:34:25 -04:00
David A. Harding
d6f00ca42f Minor formatting and comments changes 2009-03-13 12:14:08 -04:00
David A. Harding
a03a3bf66b Fixed Windows Regression, New _list Function
Commit f55f5e8b5f introduced a known regression on Windows that
prevented users from using configuration files starting with C:\.  The
following logic fixes this:
    +    ## If the file starts with a "/" use absolute path. Otherwise,
    +    ## try to find it in either $TODO_DIR or using a relative path
    +    if [ "${1:0:1}" == / ]
    +    then
    +        ## Absolute path
    +        src="$FILE"
    +    elif [ -f "$TODO_DIR/$FILE" ]
    +    then
    +        ## Path relative to todo.sh directory
    +        src="$TODO_DIR/$1"
    +    elif [ -f "$FILE" ]
    +    then
    +       ## Path relative to current working directory
    +       src="$FILE"
    +    else
    +        echo "TODO: File $FILE does not exist."
    +       exit 1
    +    fi

New _list function takes a filename and a list of search expressions.
We no longer use exec to call ourselves recursively.
2009-03-13 11:59:03 -04:00
David A. Harding
448cecb91d Simplify and Reused Code to Print ls Summary Line 2009-03-13 11:00:34 -04:00
David A. Harding
ee59233c36 Replaced Grep Loop, Fixed Sed Bug, Some Small Changes
Implemented several suggestions by Jacobo de Vera:

    > 1. [lines 539-551]: [...] replace the for loop with simply this:
    >    PADDING=${#LINES}

    > 2. [line 558]: As the script now supports a 6 digit number of tasks,
    > the first substitution should add 5 spaces instead of 2

    > 3. [lines 606-613]: The first search item is processed before the for
    >    loop, and the loop does the same for the rest. Wouldn't making this
    >    more general make the code more readable?

The changes for suggestion #3 let me add a new feature: when VERBOSE is
enabled, the summary line prints more info -- and it prints it on every
run:

    $ todo.sh ls "buy a"
    34 Buy a portable gas can @errands +safe
    --
    TODO: 1 of 49 tasks shown from /home/harding/var/git/todo/todo.txt

Also, generalizing and centralizing the code added a small but
measurable speed increase.

No new known regressions were introduced.
2009-03-12 22:23:59 -04:00
David A. Harding
f55f5e8b5f Make ls-Family Actions Use Listfile Backend
Essentially,

    ls)
	shift
	exec "$TODO_SH" listfile "$TODO_FILE" "$@"
	;;
    lsa)
	shift
	cat "$TODO_FILE" "$DONE_FILE" > "$TMP_FILE"
	exec $TODO_SH listfile "$TMP_FILE" "$@"
	;;
    lsp)
	shift ## was "listpri"
	shift ## was priority
	exec $TODO_SH listfile "$TODO_FILE" "$pri" "$@"
	;;;

Also adds the following features:

    1. Numbers are padded with up to five zeros (but only the minimum
       necessary), letting you list up to 999,999 tasks with the same
       formatting.

    2. All ls-family commands hide context, priority, and project when
       the user sets those hide options.

    3. Quoted arguments are passed on to grep as whole arguments,
       enabling the following:

	$ todo.sh ls buy a | head -n2
	34 Buy a portable gas can
	22 Buy door

	$ todo.sh ls "buy a"
	34 Buy a portable gas can

    4. listfile can take an absolute path. Any filename starting with a
       "/" will be treated as an absolute path; any other filename will
       be treated as relative to $TODO_DIR. Since a leading "/" would be
       striped by the operating system anyway under the old code, this
       is fully backward compatible.

Contains the following regressions:

    1. The ls verbose line count messages are more generic.

    2. There is no verbose line count line for lspri.

    3. I don't think listfile's absolute path feature will work on
       Windows. If it doesn't, either this patch needs to be thrown
       away, listall needs to be rewritten, or (my preference) $TMP_FILE
       needs to set as relative to $TODO_DIR.
2009-03-12 11:52:28 -04:00
David A. Harding
d508ed9dee Modularized Listing Sed
Still more to do tomorrow.
2009-03-12 01:02:10 -04:00
Matt Brubeck
62f3313ff9 Merge branch 'master' of git://github.com/ginatrapani/todo.txt-cli 2009-03-11 16:22:27 -07:00
David A. Harding
6bc374c5f2 Revert "Set ls As the Default Action"
This reverts commit 87959a8aa8.
2009-03-11 17:54:25 -04:00
David A. Harding
87959a8aa8 Set ls As the Default Action
.
Suggested by mbrubeck
2009-03-11 17:42:15 -04:00
Matt Brubeck
3e9d40ebd7 'edit' plugin to open files in a text editor. 2009-03-11 11:36:23 -07:00