From bd085a820d38cba6601e76f2e112177771c4b7d9 Mon Sep 17 00:00:00 2001 From: Scott Kostyshak Date: Sun, 5 Aug 2012 14:56:48 -0400 Subject: [PATCH] Code Cleanup - Improved style and efficiency of Perl test code. - Added alias expansion to feature log of bash completion script. - Added comments to bash completion script. --- scripts/bash/task.sh | 3 +++ test/bash_completion.t | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/bash/task.sh b/scripts/bash/task.sh index a2247039d..2341ea1a0 100644 --- a/scripts/bash/task.sh +++ b/scripts/bash/task.sh @@ -31,6 +31,7 @@ # *) task subcommands # *) project names # *) tag names +# *) aliases # # To use these routines: # @@ -50,6 +51,7 @@ # http://taskwarrior.org # ################################################################################ +#the following variable is substituted for by ../../test/bash_completion.t taskcommand='task' _task_get_tags() { @@ -85,6 +87,7 @@ _task() else prev2="" fi +# useful for debugging: # echo -e "\ncur='$cur'" # echo "prev='$prev'" # echo "prev2='$prev2'" diff --git a/test/bash_completion.t b/test/bash_completion.t index a96e63a9e..9ed38d227 100755 --- a/test/bash_completion.t +++ b/test/bash_completion.t @@ -59,18 +59,17 @@ if (open my $target, '>', 'task.sh') } } close ($source); - print $target 'COMP_WORDS=("$@")'; - print $target "\n"; - print $target 'COMP_CWORD=$(($#-1))'; - print $target "\n"; - print $target '_task'; - print $target "\n"; - print $target 'for reply_iter in "${COMPREPLY[@]}"; do'; - print $target "\n"; - print $target ' echo $reply_iter'; - print $target "\n"; - print $target 'done'; - + print $target 'COMP_WORDS=("$@")', + "\n", + 'COMP_CWORD=$(($#-1))', + "\n", + '_task', + "\n", + 'for reply_iter in "${COMPREPLY[@]}"; do', + "\n", + ' echo $reply_iter', + "\n", + 'done'; close $target; ok (-r 'task.sh', 'Created task.sh'); }