mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI2: Tightened selection of MODIFICATION Lexer::Type::number upgrade to ID
- When a write command contains no ID/UUID, looking for Lexer::Type::number arguments that are tagged as MODIFICATIONS is now limited to only positive integers that are found.
This commit is contained in:
parent
7c3560a3cd
commit
6b78abced2
1 changed files with 10 additions and 4 deletions
14
src/CLI2.cpp
14
src/CLI2.cpp
|
@ -1307,12 +1307,18 @@ void CLI2::findIDs ()
|
|||
{
|
||||
if (a.hasTag ("MODIFICATION"))
|
||||
{
|
||||
if (a._lextype == Lexer::Type::number)
|
||||
std::string raw = a.attribute ("raw");
|
||||
|
||||
// For a number to be an ID, it must not contain any sign or floating
|
||||
// point elements.
|
||||
if (a._lextype == Lexer::Type::number &&
|
||||
raw.find ('.') == std::string::npos &&
|
||||
raw.find ('e') == std::string::npos &&
|
||||
raw.find ('-') == std::string::npos)
|
||||
{
|
||||
a.unTag ("MODIFICATION");
|
||||
a.tag ("FILTER");
|
||||
std::string number = a.attribute ("raw");
|
||||
_id_ranges.push_back (std::pair <std::string, std::string> (number, number));
|
||||
_id_ranges.push_back (std::pair <std::string, std::string> (raw, raw));
|
||||
}
|
||||
else if (a._lextype == Lexer::Type::set)
|
||||
{
|
||||
|
@ -1321,7 +1327,7 @@ void CLI2::findIDs ()
|
|||
|
||||
// Split the ID list into elements.
|
||||
std::vector <std::string> elements;
|
||||
split (elements, a.attribute ("raw"), ',');
|
||||
split (elements, raw, ',');
|
||||
|
||||
for (auto& element : elements)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue