From d5beda0ffe622d6529a5d2082993c50b15799e5f Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 1 Jan 2011 17:23:51 -0800 Subject: [PATCH] bash completions: work correctly with subdirs, ie. 'redo t/' --- contrib/bash_completion.d/redo | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/contrib/bash_completion.d/redo b/contrib/bash_completion.d/redo index 796e7b8..c3c7612 100644 --- a/contrib/bash_completion.d/redo +++ b/contrib/bash_completion.d/redo @@ -1,12 +1,12 @@ -_redo() +_redo_completions() { - local cur - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - - local targets=$(for t in `ls *.do | sed 's/\.do$//'`; do echo ${t}; done) - - COMPREPLY=($(compgen -W "${targets}" $cur)) + local cur="${COMP_WORDS[COMP_CWORD]}" + local targets=$( + for t in $cur*.do; do + echo "${t%.do}" + done + ) + COMPREPLY=($(compgen -W "$targets" $cur)) } -complete -F _redo redo +complete -F _redo_completions redo