ENH: Add file completion for addto and listfile.

This enhancement to todo_completion requires a small enhancement to the listfile action: When no SRC is specified, the list of text files in the todo.txt directory is printed. This is probably also useful on its own, and better than the original behavior of printing "TODO: File  does not exist."

Note: I intentionally omitted bullet-proof error handling ($TODO_DIR non-existing or no text files contained), to avoid over-complicating this.
This commit is contained in:
Ingo Karkat
2011-11-20 16:30:31 +01:00
parent d2e0f6e38d
commit 395465b5f2
3 changed files with 33 additions and 6 deletions

View File

@@ -26,6 +26,8 @@ _todo()
case "$prev" in
command)
completions=$COMMANDS;;
addto|listfile|lf)
completions=$(TODOTXT_VERBOSE=0 todo.sh command listfile);;
-*) completions="$allCommands $OPTS";;
*) case "$cur" in
+*) completions=$(TODOTXT_VERBOSE=0 todo.sh command listproj);;