Permalink
Browse files

FIX: todo_completion problem with Bash 3.1

Regexp matching changed from 3.1 to 3.2. Make it work for Bash 3.1 by using an intermediate variable, as in 394c4c7.
Cp. http://tech.groups.yahoo.com/group/todotxt/message/4211
  • Loading branch information...
1 parent ebe6a40 commit d2c44e9ffe1cb4dc1d262b2d13fb65d8440ea287 mcguiremkm committed with inkarkat Apr 25, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 todo_completion
View
@@ -14,14 +14,15 @@ _todo()
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"
+ local -r MOVE_COMMAND_PATTERN='^(move|mv)$'
local _todo_sh=${_todo_sh:-todo.sh}
local completions
if [ $COMP_CWORD -eq 1 ]; then
completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons) $OPTS"
elif [[ $COMP_CWORD -gt 2 && ( \
- "${COMP_WORDS[COMP_CWORD-2]}" =~ ^(move|mv)$ || \
- "${COMP_WORDS[COMP_CWORD-3]}" =~ ^(move|mv)$ ) ]]; then
+ "${COMP_WORDS[COMP_CWORD-2]}" =~ $MOVE_COMMAND_PATTERN || \
+ "${COMP_WORDS[COMP_CWORD-3]}" =~ $MOVE_COMMAND_PATTERN ) ]]; then
# "move ITEM# DEST [SRC]" has file arguments on positions 2 and 3.
completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listfile)
else

0 comments on commit d2c44e9

Please sign in to comment.