Configuration

- Allows rc.tag.indicator to replace the default + indicator.
- Allows rc.active.indicator to replace the default * indicator.
- Allows rc.recurrence.indicator to replace the default R indicator.
This commit is contained in:
Paul Beckingham 2010-02-11 23:50:55 -05:00
parent 22d99806d0
commit 67546f8163
7 changed files with 52 additions and 17 deletions

View file

@ -65,6 +65,9 @@ std::string Config::defaults =
"bulk=2 # > 2 tasks considered 'a lot', for confirmation\n"
"nag=You have higher priority tasks. # Nag message to keep you honest\n" // TODO
"search.case.sensitive=yes # Setting to no allows case insensitive searches\n"
"active.indicator=* # What to show as an active task indicator\n"
"tag.indicator=+ # What to show as a tag indicator\n"
"recurrence.indicator=R # What to show as a task recurrence indicator\n"
"\n"
"# Dates\n"
"dateformat=m/d/Y # Preferred input and display date format\n"

View file

@ -715,7 +715,8 @@ int handleConfig (std::string &outs)
"displayweeknumber echo.command fontunderline locking monthsperline nag "
"next project shadow.command shadow.file shadow.notify weekstart editor "
"import.synonym.id import.synonym.uuid complete.all.projects "
"complete.all.tags search.case.sensitive hooks "
"complete.all.tags search.case.sensitive hooks active.indicator tag.indicator "
"recurrence.indicator "
#ifdef FEATURE_SHELL
"shell.prompt "
#endif

View file

@ -511,7 +511,7 @@ int runCustomReport (
for (unsigned int row = 0; row < tasks.size(); ++row)
if (tasks[row].has ("start"))
table.addCell (row, columnCount, "*");
table.addCell (row, columnCount, context.config.get ("active.indicator"));
}
else if (*col == "tags")
@ -586,7 +586,7 @@ int runCustomReport (
for (unsigned int row = 0; row < tasks.size(); ++row)
if (tasks[row].has ("recur"))
table.addCell (row, columnCount, "R");
table.addCell (row, columnCount, context.config.get ("recurrence.indicator"));
}
else if (*col == "tag_indicator")
@ -597,7 +597,7 @@ int runCustomReport (
for (unsigned int row = 0; row < tasks.size(); ++row)
if (tasks[row].getTagCount ())
table.addCell (row, columnCount, "+");
table.addCell (row, columnCount, context.config.get ("tag.indicator"));
}
else if (*col == "wait")

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 7;
use Test::More tests => 9;
# Create the rc file.
if (open my $fh, '>', 'custom.rc')
@ -50,6 +50,10 @@ like ($output, qr/ID R/, 'Recurrence indicator heading');
like ($output, qr/3\s+R/, 'Recurrence indicator t1');
unlike ($output, qr/2\s+R/, 'No recurrence indicator t2');
$output = qx{../task rc:custom.rc foo rc.recurrence.indicator=RE 2>&1};
like ($output, qr/3\s+RE/, 'Custom recurrence indicator t1');
unlike ($output, qr/2\s+RE/, 'No custom recurrence indicator t2');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 7;
use Test::More tests => 9;
# Create the rc file.
if (open my $fh, '>', 'custom.rc')
@ -50,6 +50,10 @@ like ($output, qr/ID T/, 'Tag indicator heading');
like ($output, qr/1\s+\+/, 'Tag indicator t1');
unlike ($output, qr/2\s+\+/, 'No tag indicator t2');
my $output = qx{../task rc:custom.rc foo rc.tag.indicator=TAG 2>&1};
like ($output, qr/1\s+TAG/, 'Custom ag indicator t1');
unlike ($output, qr/2\s+TAG/, 'No custom tag indicator t2');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');