mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Extract function CLI::getDuration ()
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
0c1d7291e2
commit
e8511c5efd
5 changed files with 22 additions and 32 deletions
17
src/CLI.cpp
17
src/CLI.cpp
|
@ -34,6 +34,7 @@
|
|||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <Duration.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
A2::A2 (const std::string& raw, Lexer::Type lextype)
|
||||
|
@ -589,3 +590,19 @@ std::string CLI::getAnnotation () const
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Duration CLI::getDuration () const
|
||||
{
|
||||
std::string delta;
|
||||
for (auto& arg : _args)
|
||||
{
|
||||
if (arg.hasTag ("FILTER") &&
|
||||
arg._lextype == Lexer::Type::duration)
|
||||
{
|
||||
delta = arg.attribute ("raw");
|
||||
}
|
||||
}
|
||||
Duration dur (delta);
|
||||
return dur;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue