mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug
- Fixed bug where argument processing was not properly shut off by the terminator -- in A3::tokenize.
This commit is contained in:
parent
a91b6d4564
commit
9ce7f63d85
2 changed files with 160 additions and 144 deletions
18
src/A3.cpp
18
src/A3.cpp
|
@ -652,6 +652,7 @@ const A3 A3::tokenize (const A3& input) const
|
|||
n.skipWS ();
|
||||
|
||||
// For identifying sequence versus non-sequence.
|
||||
bool terminated = false;
|
||||
bool found_sequence = false;
|
||||
bool found_something_after_sequence = false;
|
||||
|
||||
|
@ -661,7 +662,12 @@ const A3 A3::tokenize (const A3& input) const
|
|||
time_t t;
|
||||
while (! n.depleted ())
|
||||
{
|
||||
if (n.getQuoted ('"', s, true) ||
|
||||
if (!terminated)
|
||||
{
|
||||
if (n.getLiteral ("--"))
|
||||
terminated = true;
|
||||
|
||||
else if (n.getQuoted ('"', s, true) ||
|
||||
n.getQuoted ('\'', s, true))
|
||||
{
|
||||
output.push_back (Arg (s, "string"));
|
||||
|
@ -810,6 +816,16 @@ const A3 A3::tokenize (const A3& input) const
|
|||
if (found_sequence)
|
||||
found_something_after_sequence = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (n.getUntilEOS (s))
|
||||
{
|
||||
output.push_back (Arg (s, "word"));
|
||||
if (found_sequence)
|
||||
found_something_after_sequence = true;
|
||||
}
|
||||
}
|
||||
|
||||
n.skipWS ();
|
||||
}
|
||||
|
|
16
test/args.t
16
test/args.t
|
@ -44,21 +44,21 @@ qx{../src/task rc:args.rc add project:p pri:H +tag foo};
|
|||
my $output = qx{../src/task rc:args.rc info 1};
|
||||
like ($output, qr/Description\s+foo\n/ms, 'task add project:p pri:H +tag foo');
|
||||
|
||||
qx{../src/task rc:args.rc 1 project:p pri:H +tag -- foo};
|
||||
qx{../src/task rc:args.rc 1 modify project:p pri:H +tag -- foo};
|
||||
$output = qx{../src/task rc:args.rc info 1};
|
||||
like ($output, qr/Description\s+foo\n/ms, 'task 1 project:p pri:H +tag -- foo');
|
||||
like ($output, qr/Description\s+foo\n/ms, 'task 1 modify project:p pri:H +tag -- foo');
|
||||
|
||||
qx{../src/task rc:args.rc 1 project:p pri:H -- +tag foo};
|
||||
qx{../src/task rc:args.rc 1 modify project:p pri:H -- +tag foo};
|
||||
$output = qx{../src/task rc:args.rc info 1};
|
||||
like ($output, qr/Description\s+\+tag\sfoo\n/ms, 'task 1 project:p pri:H -- +tag foo');
|
||||
like ($output, qr/Description\s+\+tag\sfoo\n/ms, 'task 1 modify project:p pri:H -- +tag foo');
|
||||
|
||||
qx{../src/task rc:args.rc 1 project:p -- pri:H +tag foo};
|
||||
qx{../src/task rc:args.rc 1 modify project:p -- pri:H +tag foo};
|
||||
$output = qx{../src/task rc:args.rc info 1};
|
||||
like ($output, qr/Description\s+pri:H\s\+tag\sfoo\n/ms, 'task 1 project:p -- pri:H +tag foo');
|
||||
like ($output, qr/Description\s+pri:H\s\+tag\sfoo\n/ms, 'task 1 modify project:p -- pri:H +tag foo');
|
||||
|
||||
qx{../src/task rc:args.rc 1 -- project:p pri:H +tag foo};
|
||||
qx{../src/task rc:args.rc 1 modify -- project:p pri:H +tag foo};
|
||||
$output = qx{../src/task rc:args.rc info 1};
|
||||
like ($output, qr/Description\s+project:p\spri:H\s\+tag\sfoo\n/ms, 'task 1 -- project:p pri:H +tag foo');
|
||||
like ($output, qr/Description\s+project:p\spri:H\s\+tag\sfoo\n/ms, 'task 1 modify -- project:p pri:H +tag foo');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue