mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
init: Added :lastweek hint
This commit is contained in:
parent
b5cf680730
commit
0569071a5d
3 changed files with 20 additions and 7 deletions
|
@ -210,6 +210,7 @@ int CmdHelp (const CLI& cli)
|
|||
<< " :month This month\n"
|
||||
<< " :quarter This quarter\n"
|
||||
<< " :year This year\n"
|
||||
<< " :lastweek Last week\n"
|
||||
<< '\n'
|
||||
<< " :fill Expand time to fill surrounding available gap\n"
|
||||
<< " Only functions when exclusions are provided\n"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <Duration.h>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <iostream> // TODO Remove.
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
@ -107,6 +106,7 @@ bool expandIntervalHint (
|
|||
{":year", {"socy", "eocy"}},
|
||||
};
|
||||
|
||||
// Some hints are just synonyms.
|
||||
if (hints.find (hint) != hints.end ())
|
||||
{
|
||||
start = hints[hint][0];
|
||||
|
@ -114,6 +114,17 @@ bool expandIntervalHint (
|
|||
return true;
|
||||
}
|
||||
|
||||
// Some require math.
|
||||
if (hint == ":lastweek")
|
||||
{
|
||||
Datetime socw ("socw");
|
||||
Datetime eocw ("eocw");
|
||||
socw -= 7 * 86400;
|
||||
eocw -= 7 * 86400;
|
||||
start = socw.toString ("Y-M-D");
|
||||
end = eocw.toString ("Y-M-D");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ void initializeEntities (CLI& cli)
|
|||
cli.entity ("hint", ":month");
|
||||
cli.entity ("hint", ":quarter");
|
||||
cli.entity ("hint", ":year");
|
||||
cli.entity ("hint", ":lastweek");
|
||||
cli.entity ("hint", ":fill");
|
||||
cli.entity ("hint", ":color");
|
||||
cli.entity ("hint", ":nocolor");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue