mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-25 21:27:19 +02:00
Feature #559
- Added feature #559, which implements a new configuration variable, rc.exit.on.missing.db, which causes taskwarrior to exit if the rc.data.location is missing (thanks to Sander Marechal).
This commit is contained in:
parent
526fa07326
commit
45a757832a
8 changed files with 86 additions and 9 deletions
|
@ -50,6 +50,9 @@
|
|||
+ Added feature #523 & #659, adding 'status' as a reportable field (thanks to
|
||||
Peter De Poorter and Bryce Harrington).
|
||||
+ Added feature #545, #610, #611, #646, which support complex aliases.
|
||||
+ Added feature #559, that causes Taskwarrior to exit if the ~/.task (or
|
||||
rc.data.location override) does not exist, controlled by the
|
||||
rc.exit.on.missing.db configuration variable (thanks to Sander Marechal).
|
||||
+ Added feature #657 & #658, using the 'ids' command, tasks matching a filter
|
||||
can now be modified as a group (thanks to Bryce Harrington, Eric Fluger).
|
||||
+ Added feature #679, which makes color rules match project names in a left-
|
||||
|
|
2
NEWS
2
NEWS
|
@ -50,6 +50,8 @@ New configuration options in taskwarrior 2.0.0
|
|||
'[...]'.
|
||||
- New 'regex' control determines whether substitutions use Regular Expressions
|
||||
or simple text patterns.
|
||||
- New 'exit.on.missing.db' control causes an exit if the ~/.task directory
|
||||
(or override) is missing.
|
||||
|
||||
Newly deprecated features in taskwarrior 2.0.0
|
||||
|
||||
|
|
|
@ -153,6 +153,11 @@ don't change. Note that this should be used in the form of a command line
|
|||
override (task rc.gc=off ...), and not permanently used in the .taskrc file,
|
||||
as this significantly affects performance.
|
||||
|
||||
.TP
|
||||
.B exit.on.missing.db=no
|
||||
When set to 'yes' causes the program to exit if the database (~/.task or
|
||||
rc.data.location override) is missing. Default value is 'no'.
|
||||
|
||||
.SS TERMINAL
|
||||
.TP
|
||||
.B detection=on
|
||||
|
|
|
@ -66,6 +66,7 @@ std::string Config::defaults =
|
|||
"data.location=~/.task\n"
|
||||
"locking=on # Use file-level locking\n"
|
||||
"gc=on # Garbage-collect data files - DO NOT CHANGE unless you are sure\n"
|
||||
"exit.on.missing.db=no # Whether to exit if ~/.task is not found\n"
|
||||
"\n"
|
||||
"# Terminal\n"
|
||||
"detection=on # Detects terminal width\n"
|
||||
|
@ -596,7 +597,12 @@ void Config::createDefaultData (const std::string& data)
|
|||
{
|
||||
Directory d (data);
|
||||
if (! d.exists ())
|
||||
{
|
||||
if (getBoolean ("exit.on.missing.db"))
|
||||
throw std::string ("Error: rc.data.location does not exist - exiting according to rc.exit.on.missing.db setting.");
|
||||
|
||||
d.create ();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -140,6 +140,7 @@ int CmdShow::execute (std::string& output)
|
|||
" echo.command"
|
||||
" edit.verbose"
|
||||
" editor"
|
||||
" exit.on.missing.db"
|
||||
" export.ical.class"
|
||||
" expressions"
|
||||
" extensions"
|
||||
|
|
|
@ -57,7 +57,6 @@ void handleRecurrence ()
|
|||
{
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.loadPending (tasks);
|
||||
|
||||
std::vector <Task> modified;
|
||||
|
||||
// Look at all tasks and find any recurring ones.
|
||||
|
@ -66,6 +65,7 @@ void handleRecurrence ()
|
|||
{
|
||||
if (t->getStatus () == Task::recurring)
|
||||
{
|
||||
/*
|
||||
// Generate a list of due dates for this recurring task, regardless of
|
||||
// the mask.
|
||||
std::vector <Date> due;
|
||||
|
@ -143,6 +143,7 @@ void handleRecurrence ()
|
|||
t->set ("mask", mask);
|
||||
context.tdb.update (*t);
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
modified.push_back (*t);
|
||||
|
|
10
src/text.cpp
10
src/text.cpp
|
@ -446,10 +446,7 @@ std::string commify (const std::string& data)
|
|||
std::string lowerCase (const std::string& input)
|
||||
{
|
||||
std::string output = input;
|
||||
for (int i = 0; i < (int) input.length (); ++i)
|
||||
if (isupper (input[i]))
|
||||
output[i] = tolower (input[i]);
|
||||
|
||||
std::transform (output.begin (), output.end (), output.begin (), tolower);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
@ -457,10 +454,7 @@ std::string lowerCase (const std::string& input)
|
|||
std::string upperCase (const std::string& input)
|
||||
{
|
||||
std::string output = input;
|
||||
for (int i = 0; i < (int) input.length (); ++i)
|
||||
if (islower (input[i]))
|
||||
output[i] = toupper (input[i]);
|
||||
|
||||
std::transform (output.begin (), output.end (), output.begin (), toupper);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
|
65
test/feature.559.t
Executable file
65
test/feature.559.t
Executable file
|
@ -0,0 +1,65 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
|
||||
## 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 => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"exit.on.missing.db=yes\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Feature 559: rc.exit.on.missing.db should cause exit if rc.data.location is missing.
|
||||
qx{../src/task rc:bug.rc add foo rc.debug:1};
|
||||
my $output = qx{../src/task rc:bug.rc list};
|
||||
unlike ($output, qr/Error.+does not exist/, 'No error on extant rc.data.location');
|
||||
|
||||
$output = qx{../src/task rc:bug.rc rc.data.location=donkey list};
|
||||
like ($output, qr/Error.+does not exist/, 'Error on missing rc.data.location');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
|
||||
unlink 'completed.data';
|
||||
ok (!-r 'completed.data', 'Removed completed.data');
|
||||
|
||||
unlink 'undo.data';
|
||||
ok (!-r 'undo.data', 'Removed undo.data');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue