Enhancement - tags

- Added usage count to the tags report.
- Filled in some missing details in ChangeLog.
- Removed extraneous "srandom" call.
This commit is contained in:
Paul Beckingham 2009-07-01 18:56:12 -04:00
parent 21c3a0ef48
commit f588055b31
3 changed files with 37 additions and 16 deletions

View file

@ -39,6 +39,7 @@
+ New, more flexible, more consistent, grep-able file format.
+ If task is renamed to "cal", or there is a symlink to task called "cal",
then task can act as a replacement for the Unix "cal" command.
+ The "tags" report now shows the tag usage count.
Add:
att mods
@ -49,10 +50,15 @@ Add:
wait:
report.waiting
report.all
debug mode
new colorization support
many, many new unit tests
+ Now supports a debug mode that can be used to generate helpful information
when reporting a problem. Just run the command with "task rc.debug:on ..."
and diagnostics will be generated that will help pinpoint a problem.
+ The new "undo" command replaces the old "undo" and "undelete" command
with a complete undo stack that can rollback all changes.
------ old releases ------------------------------
1.7.1 (6/8/2009)

View file

@ -87,13 +87,6 @@ void Context::initialize ()
{
Timer t ("Context::initialize");
// Set up randomness.
#ifdef HAVE_SRANDOM
srandom (time (NULL));
#else
srand (time (NULL));
#endif
// Load the configuration file from the home directory. If the file cannot
// be found, offer to create a sample one.
loadCorrectConfigFile ();

View file

@ -137,7 +137,6 @@ std::string handleProjects ()
}
table.setColumnJustification (1, Table::right);
table.setDateFormat (context.config.get ("dateformat", "m/d/Y"));
foreach (i, unique)
{
@ -177,27 +176,50 @@ std::string handleTags ()
// Scan all the tasks for their project name, building a map using project
// names as keys.
std::map <std::string, std::string> unique;
std::map <std::string, int> unique;
foreach (t, tasks)
{
std::vector <std::string> tags;
t->getTags (tags);
foreach (tag, tags)
unique[*tag] = "";
if (unique.find (*tag) != unique.end ())
unique[*tag]++;
else
unique[*tag] = 1;
}
// Render a list of tag names from the map.
out << optionalBlankLine ();
foreach (i, unique)
out << i->first << std::endl;
if (unique.size ())
{
// Render a list of tags names from the map.
Table table;
table.addColumn ("Tag");
table.addColumn ("Count");
if (context.config.get ("color", true) ||
context.config.get (std::string ("_forcecolor"), false))
{
table.setColumnUnderline (0);
table.setColumnUnderline (1);
}
table.setColumnJustification (1, Table::right);
foreach (i, unique)
{
int row = table.addRow ();
table.addCell (row, 0, i->first);
table.addCell (row, 1, i->second);
}
out << optionalBlankLine ()
<< table.render ()
<< optionalBlankLine ()
<< unique.size ()
<< (unique.size () == 1 ? " tag" : " tags")
<< " (" << quantity << (quantity == 1 ? " task" : " tasks") << ")"
<< std::endl;
}
else
out << "No tags."
<< std::endl;