mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
hints: Added :lastyear
This commit is contained in:
parent
33f1239e93
commit
12dfee1bc8
4 changed files with 14 additions and 0 deletions
|
@ -360,6 +360,7 @@ Range hints provide convenient shortcuts to date ranges:
|
||||||
:lastweek Last week
|
:lastweek Last week
|
||||||
:lastmonth Last month
|
:lastmonth Last month
|
||||||
:lastquarter Last quarter
|
:lastquarter Last quarter
|
||||||
|
:lastyear Last year
|
||||||
|
|
||||||
|
|
||||||
.SH CONFIGURATION FILE AND OVERRIDE OPTIONS
|
.SH CONFIGURATION FILE AND OVERRIDE OPTIONS
|
||||||
|
|
|
@ -304,6 +304,7 @@ int CmdHelp (const CLI& cli)
|
||||||
<< " :lastweek Last week\n"
|
<< " :lastweek Last week\n"
|
||||||
<< " :lastmonth Last month\n"
|
<< " :lastmonth Last month\n"
|
||||||
<< " :lastquarter Last quarter\n"
|
<< " :lastquarter Last quarter\n"
|
||||||
|
<< " :lastyear Last year\n"
|
||||||
<< '\n'
|
<< '\n'
|
||||||
<< '\n';
|
<< '\n';
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,17 @@ bool expandIntervalHint (
|
||||||
range.end.toISOLocalExtended ()));
|
range.end.toISOLocalExtended ()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (hint == ":lastyear")
|
||||||
|
{
|
||||||
|
Datetime now;
|
||||||
|
range.start = Datetime (now.year () - 1, 1, 1);
|
||||||
|
range.end = Datetime (now.year () - 1, 12, 31);
|
||||||
|
debug (format ("Hint {1} expanded to {2} - {3}",
|
||||||
|
hint,
|
||||||
|
range.start.toISOLocalExtended (),
|
||||||
|
range.end.toISOLocalExtended ()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@ void initializeEntities (CLI& cli)
|
||||||
cli.entity ("hint", ":lastmonth");
|
cli.entity ("hint", ":lastmonth");
|
||||||
cli.entity ("hint", ":lastquarter");
|
cli.entity ("hint", ":lastquarter");
|
||||||
cli.entity ("hint", ":lastweek");
|
cli.entity ("hint", ":lastweek");
|
||||||
|
cli.entity ("hint", ":lastyear");
|
||||||
cli.entity ("hint", ":month");
|
cli.entity ("hint", ":month");
|
||||||
cli.entity ("hint", ":nocolor");
|
cli.entity ("hint", ":nocolor");
|
||||||
cli.entity ("hint", ":quarter");
|
cli.entity ("hint", ":quarter");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue