Browse files

Add action argument for help to todo_completion.

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...
1 parent f2b9734 commit 7acb52119096c5e5a1615c477069561f9060da5c @inkarkat inkarkat committed Apr 27, 2012
Showing with 22 additions and 0 deletions.
  1. 0 tests/
  2. +20 −0 tests/
  3. +2 −0 todo_completion
0 tests/ 100755 → 100644
No changes.
@@ -0,0 +1,20 @@
+test_description='Bash help completion functionality
+This test checks todo_completion of actions for usage help.
+. ./
+. ./
+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' ' help ' "$ACTIONS $ADDONS"
+test_todo_completion 'all actions after command help' ' command help ' "$ACTIONS $ADDONS"
+test_todo_completion 'actions beginning with a' ' help a' 'add a addto addm append app archive aardvark'
@@ -28,6 +28,8 @@ _todo()
case "$prev" in
+ help)
+ completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons)";;
completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listfile);;
-*) completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons) $OPTS";;

0 comments on commit 7acb521

Please sign in to comment.