mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
- Removed "usage" command.
This commit is contained in:
parent
038f432752
commit
396d85cd53
5 changed files with 1 additions and 103 deletions
|
@ -7,6 +7,7 @@
|
|||
with the "shadow.file" and "shadow.command" configuration variables.
|
||||
The shadow file is automatically updated whenever the task database
|
||||
changes. Useful for integrating with "Samurize".
|
||||
+ Removed "task usage" command.
|
||||
|
||||
------ old releases ------------------------------
|
||||
|
||||
|
|
|
@ -313,24 +313,6 @@ ID Project Pri Description
|
|||
This command displays all the colors that task supports.
|
||||
</p>
|
||||
|
||||
<strong>% task usage</strong>
|
||||
<p>
|
||||
If logging has been enabled by the "command.logging=on" directive
|
||||
in the .taskrc file, then task will record every command that is
|
||||
run. When this command is run, task will display a count of how
|
||||
many times each command was used.
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This command is for the purpose of seeing whether command are
|
||||
actually used.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This command is deprecated, and will be removed in task 1.5.0
|
||||
</p>
|
||||
|
||||
<strong>% task version</strong>
|
||||
<p>
|
||||
This can be used to show the version number of task, and to display
|
||||
|
|
|
@ -1628,85 +1628,6 @@ std::string handleReportGHistory (TDB& tdb, T& task, Config& conf)
|
|||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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"
|
||||
//
|
||||
std::string handleReportUsage (const TDB& tdb, T& task, Config& conf)
|
||||
{
|
||||
std::stringstream out;
|
||||
|
||||
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 ())
|
||||
out << optionalBlankLine (conf)
|
||||
<< table.render ()
|
||||
<< std::endl;
|
||||
else
|
||||
out << "No usage." << std::endl;
|
||||
}
|
||||
else
|
||||
out << "Command logging is not enabled, so no history has been kept."
|
||||
<< std::endl;
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string renderMonths (
|
||||
int firstMonth,
|
||||
|
|
|
@ -300,10 +300,6 @@ int main (int argc, char** argv)
|
|||
std::string dataLocation = expandPath (conf.get ("data.location"));
|
||||
tdb.dataDirectory (dataLocation);
|
||||
|
||||
// Log commands, if desired.
|
||||
if (conf.get ("command.logging") == "on")
|
||||
tdb.logCommand (argc, argv);
|
||||
|
||||
// Set up TDB callback.
|
||||
std::string shadowFile = expandPath (conf.get ("shadow.file"));
|
||||
if (shadowFile != "")
|
||||
|
@ -789,7 +785,6 @@ std::string runTaskCommand (
|
|||
else if (command == "oldest") out = handleReportOldest (tdb, task, conf);
|
||||
else if (command == "newest") out = handleReportNewest (tdb, task, conf);
|
||||
else if (command == "stats") out = handleReportStats (tdb, task, conf);
|
||||
else if (command == "usage") out = handleReportUsage (tdb, task, conf);
|
||||
else if (command == "" && task.getId ()) handleModify (tdb, task, conf);
|
||||
else if (command == "help") longUsage (conf);
|
||||
else shortUsage (conf);
|
||||
|
|
|
@ -95,7 +95,6 @@ std::string handleReportSummary (TDB&, T&, Config&);
|
|||
std::string handleReportNext (TDB&, T&, Config&);
|
||||
std::string handleReportHistory (TDB&, T&, Config&);
|
||||
std::string handleReportGHistory (TDB&, T&, Config&);
|
||||
std::string handleReportUsage (const TDB&, T&, Config&);
|
||||
std::string handleReportCalendar (TDB&, T&, Config&);
|
||||
std::string handleReportActive (TDB&, T&, Config&);
|
||||
std::string handleReportOverdue (TDB&, T&, Config&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue