mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI2: Fixed bug that allowed numbers to be interpreted as IDs
- For a WRITECMD with no FILTER args, if a Lexer::Type::number exists as a MODIFICATION, and that number is an unsigned integer, then promote it to an ID. Added eceptions for the 'add' and 'log' command. This feature allows for the continued use of 'task done 1', which should be deprecated.
This commit is contained in:
parent
f84677fbef
commit
d2f5937344
1 changed files with 11 additions and 3 deletions
14
src/CLI2.cpp
14
src/CLI2.cpp
|
@ -1263,11 +1263,14 @@ void CLI2::desugarFilterPatterns ()
|
|||
void CLI2::findIDs ()
|
||||
{
|
||||
bool previousArgWasAnOperator = false;
|
||||
int filterCount = 0;
|
||||
|
||||
for (auto& a : _args)
|
||||
{
|
||||
if (a.hasTag ("FILTER"))
|
||||
{
|
||||
++filterCount;
|
||||
|
||||
if (a._lextype == Lexer::Type::number)
|
||||
{
|
||||
// Skip any number that was preceded by an operator.
|
||||
|
@ -1301,9 +1304,14 @@ void CLI2::findIDs ()
|
|||
}
|
||||
}
|
||||
|
||||
// If no IDs were found, look for number/set listed as a MODIFICATION for a
|
||||
// WRITECMD.
|
||||
if (! _id_ranges.size ())
|
||||
// If no IDs were found, and no filter was specified, look for number/set
|
||||
// listed as a MODIFICATION for a WRITECMD.
|
||||
std::string command = getCommand ();
|
||||
|
||||
if (! _id_ranges.size () &&
|
||||
filterCount == 0 &&
|
||||
command != "add" &&
|
||||
command != "log")
|
||||
{
|
||||
for (auto& a : _args)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue