Merge branch '1.8.5' of tasktools.org:task into 1.8.5
This commit is contained in:
@@ -9,6 +9,12 @@
|
|||||||
to Juergen Daubert).
|
to Juergen Daubert).
|
||||||
+ Fixed bug #327 that allowed the removal of a due date from a recurring
|
+ Fixed bug #327 that allowed the removal of a due date from a recurring
|
||||||
task.
|
task.
|
||||||
|
+ Fixed bug #317 which colored tasks in the 'completed' report according to
|
||||||
|
due dates, which are no longer relevant to a completed task (thanks to
|
||||||
|
Cory Donnelly).
|
||||||
|
+ Fixed bug that was causing the 'completed' report to sort incorrectly.
|
||||||
|
+ Fixed bug #322 which failed to propagate rc overrides to shell commands.
|
||||||
|
+ Fixed redundant messages when exiting shell mode.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ Context::Context ()
|
|||||||
, tdb ()
|
, tdb ()
|
||||||
, stringtable ()
|
, stringtable ()
|
||||||
, program ("")
|
, program ("")
|
||||||
, overrides ("")
|
, file_override ("")
|
||||||
|
, var_overrides ("")
|
||||||
, cmd ()
|
, cmd ()
|
||||||
, inShadow (false)
|
, inShadow (false)
|
||||||
{
|
{
|
||||||
@@ -66,6 +67,7 @@ void Context::initialize (int argc, char** argv)
|
|||||||
{
|
{
|
||||||
// Capture the args.
|
// Capture the args.
|
||||||
for (int i = 0; i < argc; ++i)
|
for (int i = 0; i < argc; ++i)
|
||||||
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
program = argv[i];
|
program = argv[i];
|
||||||
@@ -76,6 +78,7 @@ void Context::initialize (int argc, char** argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
args.push_back (argv[i]);
|
args.push_back (argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
initialize ();
|
initialize ();
|
||||||
}
|
}
|
||||||
@@ -350,13 +353,14 @@ void Context::loadCorrectConfigFile ()
|
|||||||
std::string rc = home + "/.taskrc";
|
std::string rc = home + "/.taskrc";
|
||||||
std::string data = home + "/.task";
|
std::string data = home + "/.task";
|
||||||
|
|
||||||
// Is there an override for rc?
|
// Is there an file_override for rc:?
|
||||||
foreach (arg, args)
|
foreach (arg, args)
|
||||||
{
|
{
|
||||||
if (*arg == "--")
|
if (*arg == "--")
|
||||||
break;
|
break;
|
||||||
else if (arg->substr (0, 3) == "rc:")
|
else if (arg->substr (0, 3) == "rc:")
|
||||||
{
|
{
|
||||||
|
file_override = *arg;
|
||||||
rc = arg->substr (3, std::string::npos);
|
rc = arg->substr (3, std::string::npos);
|
||||||
|
|
||||||
home = rc;
|
home = rc;
|
||||||
@@ -380,7 +384,7 @@ void Context::loadCorrectConfigFile ()
|
|||||||
if (config.get ("data.location") != "")
|
if (config.get ("data.location") != "")
|
||||||
data = config.get ("data.location");
|
data = config.get ("data.location");
|
||||||
|
|
||||||
// Is there an override for data?
|
// Are there any var_overrides for data.location?
|
||||||
foreach (arg, args)
|
foreach (arg, args)
|
||||||
{
|
{
|
||||||
if (*arg == "--")
|
if (*arg == "--")
|
||||||
@@ -440,7 +444,7 @@ void Context::loadCorrectConfigFile ()
|
|||||||
n.getUntilEOS (value))
|
n.getUntilEOS (value))
|
||||||
{
|
{
|
||||||
config.set (name, value);
|
config.set (name, value);
|
||||||
overrides += " " + *arg;
|
var_overrides += " " + *arg;
|
||||||
footnote (std::string ("Configuration override ") + // TODO i18n
|
footnote (std::string ("Configuration override ") + // TODO i18n
|
||||||
arg->substr (3, std::string::npos));
|
arg->substr (3, std::string::npos));
|
||||||
}
|
}
|
||||||
@@ -658,15 +662,21 @@ void Context::parse (
|
|||||||
if (parseCmd.command == "" && parseArgs.size () == 0)
|
if (parseCmd.command == "" && parseArgs.size () == 0)
|
||||||
{
|
{
|
||||||
// Apply overrides, if any.
|
// Apply overrides, if any.
|
||||||
std::string defaultCommand = config.get ("default.command") + overrides;
|
std::string defaultCommand = config.get ("default.command");
|
||||||
if (defaultCommand != "")
|
if (defaultCommand != "")
|
||||||
{
|
{
|
||||||
|
// Add on the overrides.
|
||||||
|
defaultCommand += " " + file_override + " " + var_overrides;
|
||||||
|
|
||||||
// Stuff the command line.
|
// Stuff the command line.
|
||||||
args.clear ();
|
args.clear ();
|
||||||
split (args, defaultCommand, ' ');
|
split (args, defaultCommand, ' ');
|
||||||
header ("[task " + defaultCommand + "]");
|
header ("[task " + defaultCommand + "]");
|
||||||
|
|
||||||
// Reinitialize the context and recurse.
|
// Reinitialize the context and recurse.
|
||||||
|
file_override = "";
|
||||||
|
var_overrides = "";
|
||||||
|
footnotes.clear ();
|
||||||
initialize ();
|
initialize ();
|
||||||
parse (args, cmd, task, sequence, subst, filter);
|
parse (args, cmd, task, sequence, subst, filter);
|
||||||
}
|
}
|
||||||
@@ -691,6 +701,8 @@ void Context::clear ()
|
|||||||
// stringtable.clear ();
|
// stringtable.clear ();
|
||||||
program = "";
|
program = "";
|
||||||
args.clear ();
|
args.clear ();
|
||||||
|
file_override = "";
|
||||||
|
var_overrides = "";
|
||||||
cmd.command = "";
|
cmd.command = "";
|
||||||
tagAdditions.clear ();
|
tagAdditions.clear ();
|
||||||
tagRemovals.clear ();
|
tagRemovals.clear ();
|
||||||
|
|||||||
@@ -83,7 +83,8 @@ public:
|
|||||||
StringTable stringtable;
|
StringTable stringtable;
|
||||||
std::string program;
|
std::string program;
|
||||||
std::vector <std::string> args;
|
std::vector <std::string> args;
|
||||||
std::string overrides;
|
std::string file_override;
|
||||||
|
std::string var_overrides;
|
||||||
Cmd cmd;
|
Cmd cmd;
|
||||||
std::map <std::string, std::string> aliases;
|
std::map <std::string, std::string> aliases;
|
||||||
std::vector <std::string> tagAdditions;
|
std::vector <std::string> tagAdditions;
|
||||||
|
|||||||
@@ -1169,13 +1169,9 @@ void handleShell ()
|
|||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
// Preserve any special override arguments, and reapply them for each
|
// Make a copy because context.clear will delete them.
|
||||||
// shell command.
|
std::string permanentOverrides = " " + context.file_override
|
||||||
std::vector <std::string> special;
|
+ " " + context.var_overrides;
|
||||||
foreach (arg, context.args)
|
|
||||||
if (arg->substr (0, 3) == "rc." ||
|
|
||||||
arg->substr (0, 3) == "rc:")
|
|
||||||
special.push_back (*arg);
|
|
||||||
|
|
||||||
std::string quit = "quit"; // TODO i18n
|
std::string quit = "quit"; // TODO i18n
|
||||||
std::string command;
|
std::string command;
|
||||||
@@ -1187,8 +1183,10 @@ void handleShell ()
|
|||||||
|
|
||||||
command = "";
|
command = "";
|
||||||
std::getline (std::cin, command);
|
std::getline (std::cin, command);
|
||||||
command = trim (command);
|
std::string decoratedCommand = trim (command + permanentOverrides);
|
||||||
|
|
||||||
|
// When looking for the 'quit' command, use 'command', not
|
||||||
|
// 'decoratedCommand'.
|
||||||
if (command.length () > 0 &&
|
if (command.length () > 0 &&
|
||||||
command.length () <= quit.length () &&
|
command.length () <= quit.length () &&
|
||||||
lowerCase (command) == quit.substr (0, command.length ()))
|
lowerCase (command) == quit.substr (0, command.length ()))
|
||||||
@@ -1202,8 +1200,7 @@ void handleShell ()
|
|||||||
context.clear ();
|
context.clear ();
|
||||||
|
|
||||||
std::vector <std::string> args;
|
std::vector <std::string> args;
|
||||||
split (args, command, ' ');
|
split (args, decoratedCommand, ' ');
|
||||||
foreach (arg, special) context.args.push_back (*arg);
|
|
||||||
foreach (arg, args) context.args.push_back (*arg);
|
foreach (arg, args) context.args.push_back (*arg);
|
||||||
|
|
||||||
context.initialize ();
|
context.initialize ();
|
||||||
@@ -1222,6 +1219,9 @@ void handleShell ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (keepGoing && !std::cin.eof ());
|
while (keepGoing && !std::cin.eof ());
|
||||||
|
|
||||||
|
// No need to repeat any overrides after the shell quits.
|
||||||
|
context.clearMessages ();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -461,6 +461,7 @@ int runCustomReport (
|
|||||||
std::string column = sortColumn->substr (0, sortColumn->length () - 1);
|
std::string column = sortColumn->substr (0, sortColumn->length () - 1);
|
||||||
char direction = (*sortColumn)[sortColumn->length () - 1];
|
char direction = (*sortColumn)[sortColumn->length () - 1];
|
||||||
|
|
||||||
|
// TODO This code should really be using Att::type.
|
||||||
if (column == "id")
|
if (column == "id")
|
||||||
table.sortOn (columnIndex[column],
|
table.sortOn (columnIndex[column],
|
||||||
(direction == '+' ?
|
(direction == '+' ?
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ void autoColorize (
|
|||||||
// Note: fg, bg already contain colors specifically assigned via command.
|
// Note: fg, bg already contain colors specifically assigned via command.
|
||||||
// Note: These rules form a hierarchy - the last rule is King.
|
// Note: These rules form a hierarchy - the last rule is King.
|
||||||
|
|
||||||
|
Task::status status = task.getStatus ();
|
||||||
|
|
||||||
// Colorization of the tagged.
|
// Colorization of the tagged.
|
||||||
if (gsFg["color.tagged"] != Text::nocolor ||
|
if (gsFg["color.tagged"] != Text::nocolor ||
|
||||||
gsBg["color.tagged"] != Text::nocolor)
|
gsBg["color.tagged"] != Text::nocolor)
|
||||||
@@ -146,9 +148,11 @@ void autoColorize (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Colorization of the active.
|
// Colorization of the active, if not completed/deleted.
|
||||||
if (gsFg["color.active"] != Text::nocolor ||
|
if ((gsFg["color.active"] != Text::nocolor ||
|
||||||
gsBg["color.active"] != Text::nocolor)
|
gsBg["color.active"] != Text::nocolor) &&
|
||||||
|
status != Task::completed &&
|
||||||
|
status != Task::deleted)
|
||||||
{
|
{
|
||||||
if (task.has ("start"))
|
if (task.has ("start"))
|
||||||
{
|
{
|
||||||
@@ -202,7 +206,9 @@ void autoColorize (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Colorization of the due and overdue.
|
// Colorization of the due and overdue.
|
||||||
if (task.has ("due"))
|
if (task.has ("due") &&
|
||||||
|
status != Task::completed &&
|
||||||
|
status != Task::deleted)
|
||||||
{
|
{
|
||||||
std::string due = task.get ("due");
|
std::string due = task.get ("due");
|
||||||
switch (getDueState (due))
|
switch (getDueState (due))
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 14;
|
use Test::More tests => 15;
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'bulk.rc')
|
if (open my $fh, '>', 'bulk.rc')
|
||||||
@@ -49,13 +49,13 @@ qx{../task rc:bulk.rc add t4 due:thursday};
|
|||||||
qx{../task rc:bulk.rc add t5 due:friday};
|
qx{../task rc:bulk.rc add t5 due:friday};
|
||||||
qx{../task rc:bulk.rc add t6 due:saturday};
|
qx{../task rc:bulk.rc add t6 due:saturday};
|
||||||
|
|
||||||
my $output = qx{yes|../task rc:bulk.rc pro:p1 pri:M 4 5 6};
|
my $output = qx{echo "quit"|../task rc:bulk.rc pro:p1 pri:M 4 5 6};
|
||||||
|
like ($output, qr/Modified 0 tasks/, '"quit" prevents any further modifications');
|
||||||
|
|
||||||
|
my $output = qx{echo "all"|../task rc:bulk.rc pro:p1 pri:M 4 5 6};
|
||||||
unlike ($output, qr/Task 4 "t4"\n - No changes were made/, 'Task 4 modified');
|
unlike ($output, qr/Task 4 "t4"\n - No changes were made/, 'Task 4 modified');
|
||||||
unlike ($output, qr/Task 5 "t5"\n - No changes were made/, 'Task 5 modified');
|
unlike ($output, qr/Task 5 "t5"\n - No changes were made/, 'Task 5 modified');
|
||||||
unlike ($output, qr/Task 6 "t6"\n - No changes were made/, 'Task 6 modified');
|
unlike ($output, qr/Task 6 "t6"\n - No changes were made/, 'Task 6 modified');
|
||||||
#diag ("---");
|
|
||||||
#diag ($output);
|
|
||||||
#diag ("---");
|
|
||||||
|
|
||||||
$output = qx{../task rc:bulk.rc info 4};
|
$output = qx{../task rc:bulk.rc info 4};
|
||||||
like ($output, qr/Project\s+p1/, 'project applied to 4');
|
like ($output, qr/Project\s+p1/, 'project applied to 4');
|
||||||
|
|||||||
12
src/text.cpp
12
src/text.cpp
@@ -57,14 +57,16 @@ void wrapText (
|
|||||||
void split (
|
void split (
|
||||||
std::vector<std::string>& results,
|
std::vector<std::string>& results,
|
||||||
const std::string& input,
|
const std::string& input,
|
||||||
const char delimiter)
|
const char delimiter,
|
||||||
|
bool nontrivial /* = true */)
|
||||||
{
|
{
|
||||||
results.clear ();
|
results.clear ();
|
||||||
std::string::size_type start = 0;
|
std::string::size_type start = 0;
|
||||||
std::string::size_type i;
|
std::string::size_type i;
|
||||||
while ((i = input.find (delimiter, start)) != std::string::npos)
|
while ((i = input.find (delimiter, start)) != std::string::npos)
|
||||||
{
|
{
|
||||||
results.push_back (input.substr (start, i - start));
|
if (!nontrivial || i != start)
|
||||||
|
results.push_back (input.substr (start, i - start));
|
||||||
start = i + 1;
|
start = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +78,8 @@ void split (
|
|||||||
void split (
|
void split (
|
||||||
std::vector<std::string>& results,
|
std::vector<std::string>& results,
|
||||||
const std::string& input,
|
const std::string& input,
|
||||||
const std::string& delimiter)
|
const std::string& delimiter,
|
||||||
|
bool nontrivial /* = true */)
|
||||||
{
|
{
|
||||||
results.clear ();
|
results.clear ();
|
||||||
std::string::size_type length = delimiter.length ();
|
std::string::size_type length = delimiter.length ();
|
||||||
@@ -85,7 +88,8 @@ void split (
|
|||||||
std::string::size_type i;
|
std::string::size_type i;
|
||||||
while ((i = input.find (delimiter, start)) != std::string::npos)
|
while ((i = input.find (delimiter, start)) != std::string::npos)
|
||||||
{
|
{
|
||||||
results.push_back (input.substr (start, i - start));
|
if (!nontrivial || i != start)
|
||||||
|
results.push_back (input.substr (start, i - start));
|
||||||
start = i + length;
|
start = i + length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ std::string trimRight (const std::string& in, const std::string& t = " ");
|
|||||||
std::string trim (const std::string& in, const std::string& t = " ");
|
std::string trim (const std::string& in, const std::string& t = " ");
|
||||||
std::string unquoteText (const std::string&);
|
std::string unquoteText (const std::string&);
|
||||||
void extractLine (std::string&, std::string&, int);
|
void extractLine (std::string&, std::string&, int);
|
||||||
void split (std::vector<std::string>&, const std::string&, const char);
|
void split (std::vector<std::string>&, const std::string&, const char, bool nontrivial = true);
|
||||||
void split (std::vector<std::string>&, const std::string&, const std::string&);
|
void split (std::vector<std::string>&, const std::string&, const std::string&, bool nontrivial = true);
|
||||||
void join (std::string&, const std::string&, const std::vector<std::string>&);
|
void join (std::string&, const std::string&, const std::vector<std::string>&);
|
||||||
std::string commify (const std::string&);
|
std::string commify (const std::string&);
|
||||||
std::string lowerCase (const std::string&);
|
std::string lowerCase (const std::string&);
|
||||||
|
|||||||
Reference in New Issue
Block a user