Skip to content

Commit

Permalink
Add action argument for help to todo_completion.
Browse files Browse the repository at this point in the history
Note that this is not perfect, as it only handles completing a single action after "help", but that should over the most important use case.
  • Loading branch information
inkarkat committed Apr 27, 2012
1 parent f2b9734 commit 7acb521
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Empty file modified tests/actions-test-lib.sh
100755 → 100644
Empty file.
20 changes: 20 additions & 0 deletions tests/t6100-completion-help.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
#

test_description='Bash help completion functionality
This test checks todo_completion of actions for usage help.
'
. ./actions-test-lib.sh
. ./test-lib.sh
make_action "zany"
make_action "aardvark"

readonly ACTIONS='add a addto addm append app archive command del rm depri dp do help list ls listaddons listall lsa listcon lsc listfile lf listpri lsp listproj lsprj move mv prepend prep pri p replace report shorthelp'
readonly ADDONS='aardvark zany'

test_todo_completion 'all actions after help' 'todo.sh help ' "$ACTIONS $ADDONS"
test_todo_completion 'all actions after command help' 'todo.sh command help ' "$ACTIONS $ADDONS"
test_todo_completion 'actions beginning with a' 'todo.sh help a' 'add a addto addm append app archive aardvark'

test_done
2 changes: 2 additions & 0 deletions todo_completion
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ _todo()
case "$prev" in
command)
completions=$COMMANDS;;
help)
completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons)";;
addto|listfile|lf)
completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listfile);;
-*) completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons) $OPTS";;
Expand Down

0 comments on commit 7acb521

Please sign in to comment.