mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Parser
- Code cleanup of ::findBinary.
This commit is contained in:
parent
f898953a2e
commit
0a4dcc1a21
1 changed files with 1 additions and 8 deletions
|
@ -329,8 +329,7 @@ void Parser::collect (
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Locate and tag the binary. It is assumed that the binary is the first
|
// Locate and tag the binary. Simply look at the top-level, first branch.
|
||||||
// argument, which is valid.
|
|
||||||
void Parser::findBinary ()
|
void Parser::findBinary ()
|
||||||
{
|
{
|
||||||
if (_tree->_branches.size () >= 1)
|
if (_tree->_branches.size () >= 1)
|
||||||
|
@ -340,20 +339,14 @@ void Parser::findBinary ()
|
||||||
std::string binary = _tree->_branches[0]->attribute ("raw");
|
std::string binary = _tree->_branches[0]->attribute ("raw");
|
||||||
std::string::size_type slash = binary.rfind ('/');
|
std::string::size_type slash = binary.rfind ('/');
|
||||||
if (slash != std::string::npos)
|
if (slash != std::string::npos)
|
||||||
{
|
|
||||||
binary = binary.substr (slash + 1);
|
binary = binary.substr (slash + 1);
|
||||||
}
|
|
||||||
|
|
||||||
_tree->_branches[0]->attribute ("basename", binary);
|
_tree->_branches[0]->attribute ("basename", binary);
|
||||||
|
|
||||||
if (binary == "cal" || binary == "calendar")
|
if (binary == "cal" || binary == "calendar")
|
||||||
{
|
|
||||||
_tree->_branches[0]->tag ("CALENDAR");
|
_tree->_branches[0]->tag ("CALENDAR");
|
||||||
}
|
|
||||||
else if (binary == "task" || binary == "tw" || binary == "t")
|
else if (binary == "task" || binary == "tw" || binary == "t")
|
||||||
{
|
|
||||||
_tree->_branches[0]->tag ("TW");
|
_tree->_branches[0]->tag ("TW");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue