mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
TI-65: The 'tags' command should support a filter
This commit is contained in:
parent
d60af9bab2
commit
57bc4d71c8
7 changed files with 21 additions and 19 deletions
|
@ -26,6 +26,7 @@
|
||||||
(thanks to Thomas Lauf).
|
(thanks to Thomas Lauf).
|
||||||
- TI-64 Command 'stop' with date before current interval's start date causes segfault
|
- TI-64 Command 'stop' with date before current interval's start date causes segfault
|
||||||
(thanks to Thomas Lauf).
|
(thanks to Thomas Lauf).
|
||||||
|
- TI-65 The 'tags' command should support a filter
|
||||||
- Fixed Python 3 support of the holiday/refresh script
|
- Fixed Python 3 support of the holiday/refresh script
|
||||||
(thanks to Jelle van der Waa).
|
(thanks to Jelle van der Waa).
|
||||||
- Added missing man page link
|
- Added missing man page link
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -5,6 +5,7 @@ New Features in 1.1.0
|
||||||
tag 'Home.Garden' as well as individual 'Home', 'Garden' tags.
|
tag 'Home.Garden' as well as individual 'Home', 'Garden' tags.
|
||||||
- Taskwarrior integration hook now stops the clock in more situations, such
|
- Taskwarrior integration hook now stops the clock in more situations, such
|
||||||
as deleting or waiting a task.
|
as deleting or waiting a task.
|
||||||
|
- The 'tags' command now suports filters.
|
||||||
|
|
||||||
Features not implemented in 1.1.0
|
Features not implemented in 1.1.0
|
||||||
|
|
||||||
|
|
|
@ -371,8 +371,9 @@ Note that you can tag multiple intervals, with multiple tags:
|
||||||
See also 'summary', 'shorten', 'lengthen', 'untag'.
|
See also 'summary', 'shorten', 'lengthen', 'untag'.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B timew tags
|
.B timew tags [<interval>] [<tag> ...]
|
||||||
Displays all the tags that have been used.
|
Displays all the tags that have been used by default. When a filter is specified,
|
||||||
|
shows only the tags that were used during that time.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B timew track <interval> [<tag> ...]
|
.B timew track <interval> [<tag> ...]
|
||||||
|
|
|
@ -61,7 +61,7 @@ int CmdHelpUsage (const Extensions& extensions)
|
||||||
<< " timew stop [<tag> ...]\n"
|
<< " timew stop [<tag> ...]\n"
|
||||||
<< " timew summary [<interval>] [<tag> ...]\n"
|
<< " timew summary [<interval>] [<tag> ...]\n"
|
||||||
<< " timew tag @<id> [@<id> ...] <tag> [<tag> ...]\n"
|
<< " timew tag @<id> [@<id> ...] <tag> [<tag> ...]\n"
|
||||||
<< " timew tags\n"
|
<< " timew tags [<interval>] [<tag> ...]\n"
|
||||||
<< " timew track <interval> [<tag> ...]\n"
|
<< " timew track <interval> [<tag> ...]\n"
|
||||||
<< " timew untag @<id> [@<id> ...] <tag> [<tag> ...]\n"
|
<< " timew untag @<id> [@<id> ...] <tag> [<tag> ...]\n"
|
||||||
<< " timew week [<interval>] [<tag> ...]\n"
|
<< " timew week [<interval>] [<tag> ...]\n"
|
||||||
|
@ -849,9 +849,10 @@ int CmdHelp (
|
||||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||||
else if (words[0] == "tags")
|
else if (words[0] == "tags")
|
||||||
std::cout << '\n'
|
std::cout << '\n'
|
||||||
<< "Syntax: timew tags\n"
|
<< "Syntax: timew tags [<interval>] [<tag> ...]\n"
|
||||||
<< '\n'
|
<< '\n'
|
||||||
<< "Displays all the tags that have been used.\n"
|
<< "Displays all the tags that have been used by default. When a filter is specified,\n"
|
||||||
|
<< "shows only the tags that were used during that time.\n"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
|
|
||||||
// Ruler 1 2 3 4 5 6 7 8
|
// Ruler 1 2 3 4 5 6 7 8
|
||||||
|
|
|
@ -33,21 +33,19 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int CmdTags (Rules& rules, Database& database)
|
int CmdTags (
|
||||||
|
const CLI& cli,
|
||||||
|
Rules& rules,
|
||||||
|
Database& database)
|
||||||
{
|
{
|
||||||
|
// Create a filter, with no default range.
|
||||||
|
auto filter = getFilter (cli);
|
||||||
|
|
||||||
// Generate a unique, ordered list of tags.
|
// Generate a unique, ordered list of tags.
|
||||||
std::set <std::string> tags;
|
std::set <std::string> tags;
|
||||||
for (auto& line : database.allLines ())
|
for (const auto& interval : getTracked (database, rules, filter))
|
||||||
{
|
for (auto& tag : interval.tags ())
|
||||||
if (line[0] == 'i')
|
tags.insert (tag);
|
||||||
{
|
|
||||||
Interval interval;
|
|
||||||
interval.initialize (line);
|
|
||||||
|
|
||||||
for (auto& tag : interval.tags ())
|
|
||||||
tags.insert (tag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shows all tags.
|
// Shows all tags.
|
||||||
if (tags.size ())
|
if (tags.size ())
|
||||||
|
|
|
@ -56,7 +56,7 @@ int CmdSplit (const CLI&, Rules&, Database& );
|
||||||
int CmdStart (const CLI&, Rules&, Database& );
|
int CmdStart (const CLI&, Rules&, Database& );
|
||||||
int CmdStop (const CLI&, Rules&, Database& );
|
int CmdStop (const CLI&, Rules&, Database& );
|
||||||
int CmdTag (const CLI&, Rules&, Database& );
|
int CmdTag (const CLI&, Rules&, Database& );
|
||||||
int CmdTags ( Rules&, Database& );
|
int CmdTags (const CLI&, Rules&, Database& );
|
||||||
int CmdTrack (const CLI&, Rules&, Database& );
|
int CmdTrack (const CLI&, Rules&, Database& );
|
||||||
int CmdUntag (const CLI&, Rules&, Database& );
|
int CmdUntag (const CLI&, Rules&, Database& );
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,7 @@ int dispatchCommand (
|
||||||
else if (command == "stop") status = CmdStop (cli, rules, database );
|
else if (command == "stop") status = CmdStop (cli, rules, database );
|
||||||
else if (command == "summary") status = CmdSummary (cli, rules, database );
|
else if (command == "summary") status = CmdSummary (cli, rules, database );
|
||||||
else if (command == "tag") status = CmdTag (cli, rules, database );
|
else if (command == "tag") status = CmdTag (cli, rules, database );
|
||||||
else if (command == "tags") status = CmdTags ( rules, database );
|
else if (command == "tags") status = CmdTags (cli, rules, database );
|
||||||
else if (command == "track") status = CmdTrack (cli, rules, database );
|
else if (command == "track") status = CmdTrack (cli, rules, database );
|
||||||
else if (command == "untag") status = CmdUntag (cli, rules, database );
|
else if (command == "untag") status = CmdUntag (cli, rules, database );
|
||||||
else if (command == "week") status = CmdChartWeek (cli, rules, database );
|
else if (command == "week") status = CmdChartWeek (cli, rules, database );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue