mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Add hint :all
- Closes #206 Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
6117ce1a84
commit
c9eec956e4
3 changed files with 27 additions and 5 deletions
23
src/CLI.cpp
23
src/CLI.cpp
|
@ -664,12 +664,19 @@ Interval CLI::getFilter (const Range& default_range) const
|
|||
Range range;
|
||||
if (expandIntervalHint (canonical, range))
|
||||
{
|
||||
start = range.start.toISO ();
|
||||
end = range.end.toISO ();
|
||||
if (range.is_empty ())
|
||||
{
|
||||
args.push_back ("<all>");
|
||||
}
|
||||
else
|
||||
{
|
||||
start = range.start.toISO ();
|
||||
end = range.end.toISO ();
|
||||
|
||||
args.push_back ("<date>");
|
||||
args.push_back ("-");
|
||||
args.push_back ("<date>");
|
||||
args.push_back ("<date>");
|
||||
args.push_back ("-");
|
||||
args.push_back ("<date>");
|
||||
}
|
||||
}
|
||||
|
||||
// Hints that are not expandable to a date range are ignored.
|
||||
|
@ -807,6 +814,12 @@ Interval CLI::getFilter (const Range& default_range) const
|
|||
filter.setRange ({now - Duration (duration).toTime_t (), now});
|
||||
}
|
||||
|
||||
// :all
|
||||
else if (args.size () == 1 && args[0] == "<all>")
|
||||
{
|
||||
filter.setRange (0, 0);
|
||||
}
|
||||
|
||||
// Unrecognized date range construct.
|
||||
else if (! args.empty ())
|
||||
{
|
||||
|
|
|
@ -176,6 +176,14 @@ bool expandIntervalHint (
|
|||
return true;
|
||||
}
|
||||
|
||||
if (hint == ":all")
|
||||
{
|
||||
range.start = 0;
|
||||
range.end = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Some require math.
|
||||
if (hint == ":lastweek")
|
||||
{
|
||||
|
|
|
@ -88,6 +88,7 @@ void initializeEntities (CLI& cli)
|
|||
cli.entity ("extension", "week");
|
||||
|
||||
// Hint entities.
|
||||
cli.entity ("hint", ":all");
|
||||
cli.entity ("hint", ":adjust");
|
||||
cli.entity ("hint", ":blank");
|
||||
cli.entity ("hint", ":color");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue