mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Add early return to CmdCancel
This commit is contained in:
parent
63ff00e1ec
commit
39eb1a8056
1 changed files with 9 additions and 7 deletions
|
@ -35,18 +35,20 @@ int CmdCancel (
|
||||||
{
|
{
|
||||||
// If there is an open interval, cancel it by deleting it..
|
// If there is an open interval, cancel it by deleting it..
|
||||||
auto latest = getLatestInterval (database);
|
auto latest = getLatestInterval (database);
|
||||||
if (latest.range.is_open ())
|
|
||||||
{
|
if (!latest.range.is_open ())
|
||||||
database.deleteInterval (latest);
|
|
||||||
if (rules.getBoolean ("verbose"))
|
|
||||||
std::cout << "Canceled active time tracking.\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (rules.getBoolean ("verbose"))
|
if (rules.getBoolean ("verbose"))
|
||||||
std::cout << "There is no active time tracking.\n";
|
std::cout << "There is no active time tracking.\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
database.deleteInterval(latest);
|
||||||
|
|
||||||
|
if (rules.getBoolean ("verbose"))
|
||||||
|
std::cout << "Canceled active time tracking.\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue