TW-1419: On add '-tag' is considered a tag removal, which makes no sense.

This commit is contained in:
Paul Beckingham 2015-07-13 14:24:24 -04:00
parent 585ae52be3
commit a7eb32272c
3 changed files with 23 additions and 6 deletions

View file

@ -13,6 +13,7 @@
(thanks to Onion). (thanks to Onion).
- TW-1389 tw will import same UUID n-times if part of same import (thanks to - TW-1389 tw will import same UUID n-times if part of same import (thanks to
Markus Beppler). Markus Beppler).
- TW-1419 On add '-tag' is considered a tag removal, which makes no sense.
- TW-1430 Slashes in project names don't work (thanks to Richard Boß). - TW-1430 Slashes in project names don't work (thanks to Richard Boß).
- TW-1432 start/stop can be issued on completed tasks (thanks to Renato Alves). - TW-1432 start/stop can be issued on completed tasks (thanks to Renato Alves).
- TW-1440 "task import" from STDIN (thanks to Renato Alves). - TW-1440 "task import" from STDIN (thanks to Renato Alves).

View file

@ -481,9 +481,13 @@ void CLI2::lexArguments ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Until the Lexer gains access to CLI2::_entities, it can only guess at whether // Until the Lexer gains access to CLI2::_entities, it can only guess at whether
// a command is a DOM reference. Scan all Lexer::Type::dom arguments, and demote // a command is a DOM reference.
// to Lexer::Type::word any unrecognized arguments. //
void CLI2::demoteDOM () // [1] Scan all Lexer::Type::dom arguments, and demote to Lexer::Type::word any
// unrecognized arguments.
// [2] Scan all MODIFICATION args for the 'add' and 'log' commands, and demote
// any Lexer::Type::Tag args with sense '-' to Lexer::Type::word.
void CLI2::demotion ()
{ {
bool changes = false; bool changes = false;
@ -498,11 +502,23 @@ void CLI2::demoteDOM ()
changes = true; changes = true;
} }
} }
if (a._lextype == Lexer::Type::tag &&
a.attribute ("sign") == "-")
{
std::string command = getCommand ();
if (command == "add" ||
command == "log")
{
a._lextype = Lexer::Type::word;
changes = true;
}
}
} }
if (changes) if (changes)
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 3)
context.debug (dump ("CLI2::analyze demoteDOM")); context.debug (dump ("CLI2::analyze demotion"));
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -516,7 +532,6 @@ void CLI2::analyze ()
_args.clear (); _args.clear ();
handleArg0 (); handleArg0 ();
lexArguments (); lexArguments ();
demoteDOM ();
// Process _args. // Process _args.
aliasExpansion (); aliasExpansion ();
@ -527,6 +542,7 @@ void CLI2::analyze ()
throw std::string (STRING_TRIVIAL_INPUT); throw std::string (STRING_TRIVIAL_INPUT);
} }
demotion ();
canonicalizeNames (); canonicalizeNames ();
} }

View file

@ -89,7 +89,7 @@ public:
private: private:
void handleArg0 (); void handleArg0 ();
void lexArguments (); void lexArguments ();
void demoteDOM (); void demotion ();
void aliasExpansion (); void aliasExpansion ();
void canonicalizeNames (); void canonicalizeNames ();
bool findCommand (); bool findCommand ();