mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI
- More strict definition of what is a tag.
This commit is contained in:
parent
2b3f7a2fb6
commit
4ec1f17557
1 changed files with 6 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream> // TODO Remove.
|
#include <iostream> // TODO Remove.
|
||||||
|
#include <ctype.h>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
#include <Nibbler.h>
|
#include <Nibbler.h>
|
||||||
#include <Lexer.h>
|
#include <Lexer.h>
|
||||||
|
@ -2065,10 +2066,15 @@ bool CLI::isCommand (const std::string& raw) const
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Valid tag
|
||||||
|
// - Length > 1
|
||||||
|
// - Starts with +/-
|
||||||
|
// - Tag does not start with a digit
|
||||||
bool CLI::isTag (const std::string& raw) const
|
bool CLI::isTag (const std::string& raw) const
|
||||||
{
|
{
|
||||||
if (raw.size () >= 2 &&
|
if (raw.size () >= 2 &&
|
||||||
(raw[0] == '+' || raw[0] == '-') &&
|
(raw[0] == '+' || raw[0] == '-') &&
|
||||||
|
! isdigit(raw[1]) &&
|
||||||
raw.find (' ') == std::string::npos)
|
raw.find (' ') == std::string::npos)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue