Bash Completion

- Improved bash completion when TASKRC is exported.
- Added a unit test.

Description of previous behavior:

  $ export TASKRC=/tmp/.taskrc
  $ task ad<TAB><TAB>

lead to the following output:

  $ task adTASKRC override: /tmp/.taskrc
  dTASKRC override: /tmp/.taskrc
  TASKRC override: /tmp/.taskrc

Signed-off-by: Paul Beckingham <paul@beckingham.net>
This commit is contained in:
Scott Kostyshak
2014-07-04 16:35:15 -04:00
committed by Paul Beckingham
parent 222c357c0a
commit 6eee9e0544
3 changed files with 9 additions and 4 deletions

View File

@@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 16;
use Test::More tests => 18;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@@ -55,9 +55,9 @@ if (open my $target, '>', 'task.sh')
{
my $temp=$_;
chomp($_);
if ($_ eq qw{taskcommand='task'})
if ($_ eq "taskcommand='task rc.verbose:nothing'")
{
print $target "taskcommand='../src/task rc:bug.rc'";
print $target "taskcommand='../src/task rc.verbose:nothing rc:bug.rc'";
}
else
{
@@ -107,6 +107,10 @@ $output = qx{bash ./task.sh task proj : to 2>&1};
ok ($? == 0, 'Exit status check');
unlike ($output, qr/todd/, '\'proj:\' does not expand if abbreviation.minimum is 5');
$output = qx{TASKRC=bug.rc bash ./task.sh task ad to 2>&1};
ok ($? == 0, 'Exit status check');
unlike ($output, qr/override/, 'taskrc override does not display');
# there should be no gc coming from bash completion
qx{../src/task rc:bug.rc add this task should be number 2 and stay number 2 2>&1};
ok ($? == 0, 'Exit status check');