- Removed support for the "command.logging" configuration variable and

the "task usage" command.
This commit is contained in:
Paul Beckingham 2008-09-20 20:46:20 -04:00
parent 78fae5195b
commit d837a25be7
12 changed files with 6 additions and 171 deletions

View file

@ -1594,81 +1594,6 @@ void handleReportGHistory (TDB& tdb, T& task, Config& conf)
std::cout << "No tasks." << std::endl;
}
////////////////////////////////////////////////////////////////////////////////
// A summary of the command usage. Not useful to users, but used to display
// usage statistics for feedback.
//
// 2006-12-04 19:59:43 "task list"
//
void handleReportUsage (const TDB& tdb, T& task, Config& conf)
{
if (conf.get ("command.logging") == "on")
{
std::map <std::string, int> usage;
std::vector <std::string> all;
tdb.logRead (all);
for (unsigned int i = 0; i < all.size (); ++i)
{
// 0123456789012345678901
// v 21
// 2006-12-04 19:59:43 "task list"
std::string command = all[i].substr (21, all[i].length () - 22);
// Parse as a command line.
std::vector <std::string> args;
split (args, command, " ");
try
{
T task;
std::string commandName;
parse (args, commandName, task, conf);
usage[commandName]++;
}
// Deliberately ignore errors from parsing the command log, as there may
// be commands from a prior version of task in there, which were
// abbreviated, and are now ambiguous.
catch (...) {}
}
// Now render the table.
Table table;
table.addColumn ("Command");
table.addColumn ("Frequency");
if (conf.get ("color", true))
{
table.setColumnUnderline (0);
table.setColumnUnderline (1);
}
else
table.setTableDashedUnderline ();
table.setColumnJustification (1, Table::right);
table.sortOn (1, Table::descendingNumeric);
table.setDateFormat (conf.get ("dateformat", "m/d/Y"));
foreach (i, usage)
{
int row = table.addRow ();
table.addCell (row, 0, (i->first == "" ? "(modify)" : i->first));
table.addCell (row, 1, i->second);
}
if (table.rowCount ())
std::cout << optionalBlankLine (conf)
<< table.render ()
<< std::endl;
else
std::cout << "No usage." << std::endl;
}
else
std::cout << "Command logging is not enabled, so no history has been kept."
<< std::endl;
}
////////////////////////////////////////////////////////////////////////////////
std::string renderMonths (
int firstMonth,