Config - defaults

- Config is now providing a default set of all configuration variables.
- The default set is used to both initialize a Config object, and to
  create a sample .taskrc.
This commit is contained in:
Paul Beckingham 2010-01-15 02:50:46 -05:00
parent 0002376f2a
commit 0faf7fa8ee
12 changed files with 298 additions and 396 deletions

View file

@ -33,7 +33,8 @@ use Test::More tests => 13;
# Create the rc file.
if (open my $fh, '>', 'add.rc')
{
print $fh "data.location=.\n";
print $fh "data.location=.\n",
"confirmation=off\n";
close $fh;
ok (-r 'add.rc', 'Created add.rc');
}

View file

@ -36,6 +36,7 @@ if (open my $fh, '>', 'annotate.rc')
# Note: Use 'rrr' to guarantee a unique report name. Using 'r' conflicts
# with 'recurring'.
print $fh "data.location=.\n",
"confirmation=off\n",
"report.rrr.description=rrr\n",
"report.rrr.columns=id,description\n",
"report.rrr.sort=id+\n";

View file

@ -155,8 +155,8 @@ int main (int argc, char** argv)
t.ok (good, "Att::mod (noword)");
good = true;
try {a6.mod ("fartwizzle");} catch (...) {good = false;}
t.notok (good, "Att::mod (fartwizzle)");
try {a6.mod ("unrecognized");} catch (...) {good = false;}
t.notok (good, "Att::mod (unrecognized)");
// Att::parse
Nibbler n ("");

View file

@ -33,7 +33,8 @@ use Test::More tests => 7;
# Create the rc file.
if (open my $fh, '>', 'basic.rc')
{
print $fh "data.location=.\n";
print $fh "data.location=.\n",
"default.command=\n";
close $fh;
ok (-r 'basic.rc', 'Created basic.rc');
}

View file

@ -1,59 +0,0 @@
#! /usr/bin/perl
################################################################################
## task - a command line task list manager.
##
## Copyright 2006 - 2010, Paul Beckingham.
## All rights reserved.
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 2 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, write to the
##
## Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor,
## Boston, MA
## 02110-1301
## USA
##
################################################################################
use strict;
use warnings;
use Test::More tests => 6;
# Create the rc file.
if (open my $fh, '>', 'duplicate.rc')
{
print $fh "data.location=.\n",
"data.location=.\n",
"color=off\n";
close $fh;
ok (-r 'duplicate.rc', 'Created duplicate.rc');
}
# Test the add command.
my $output = qx{../task rc:duplicate.rc config};
like ($output, qr/data\.location/ms, 'Duplicate entry detected');
unlike ($output, qr/colorl/ms, 'Single entry not ignored');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');
unlink 'undo.data';
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'duplicate.rc';
ok (!-r 'duplicate.rc', 'Removed duplicate.rc');
exit 0;

View file

@ -34,6 +34,7 @@ use Test::More tests => 17;
if (open my $fh, '>', 'delete.rc')
{
print $fh "data.location=.\n",
"confirmation=no\n",
"echo.command=no\n";
close $fh;
ok (-r 'delete.rc', 'Created delete.rc');

View file

@ -33,7 +33,8 @@ use Test::More tests => 28;
# Create the rc file.
if (open my $fh, '>', 'seq.rc')
{
print $fh "data.location=.\n";
print $fh "data.location=.\n",
"confirmation=off\n";
close $fh;
ok (-r 'seq.rc', 'Created seq.rc');
}

View file

@ -34,6 +34,7 @@ use Test::More tests => 22;
if (open my $fh, '>', 'shadow.rc')
{
print $fh "data.location=.\n",
"confirmation=off\n",
"shadow.file=./shadow.txt\n",
"shadow.command=rc:shadow.rc stats\n",
"shadow.notify=on\n";