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.
This commit is contained in:
Scott Kostyshak 2012-08-05 14:56:48 -04:00 committed by Paul Beckingham
parent 54b2e10da4
commit bd085a820d
2 changed files with 14 additions and 12 deletions

View file

@ -31,6 +31,7 @@
# *) task subcommands # *) task subcommands
# *) project names # *) project names
# *) tag names # *) tag names
# *) aliases
# #
# To use these routines: # To use these routines:
# #
@ -50,6 +51,7 @@
# http://taskwarrior.org # http://taskwarrior.org
# #
################################################################################ ################################################################################
#the following variable is substituted for by ../../test/bash_completion.t
taskcommand='task' taskcommand='task'
_task_get_tags() { _task_get_tags() {
@ -85,6 +87,7 @@ _task()
else else
prev2="" prev2=""
fi fi
# useful for debugging:
# echo -e "\ncur='$cur'" # echo -e "\ncur='$cur'"
# echo "prev='$prev'" # echo "prev='$prev'"
# echo "prev2='$prev2'" # echo "prev2='$prev2'"

View file

@ -59,18 +59,17 @@ if (open my $target, '>', 'task.sh')
} }
} }
close ($source); close ($source);
print $target 'COMP_WORDS=("$@")'; print $target 'COMP_WORDS=("$@")',
print $target "\n"; "\n",
print $target 'COMP_CWORD=$(($#-1))'; 'COMP_CWORD=$(($#-1))',
print $target "\n"; "\n",
print $target '_task'; '_task',
print $target "\n"; "\n",
print $target 'for reply_iter in "${COMPREPLY[@]}"; do'; 'for reply_iter in "${COMPREPLY[@]}"; do',
print $target "\n"; "\n",
print $target ' echo $reply_iter'; ' echo $reply_iter',
print $target "\n"; "\n",
print $target 'done'; 'done';
close $target; close $target;
ok (-r 'task.sh', 'Created task.sh'); ok (-r 'task.sh', 'Created task.sh');
} }