mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-07 21:07:20 +02:00
add initial bulk run from pre-commit over all files
This commit is contained in:
parent
665aeeef61
commit
93356b39c3
418 changed files with 21354 additions and 23858 deletions
|
@ -28,81 +28,74 @@
|
|||
// cmake.h include header must come first
|
||||
|
||||
#include <CmdReports.h>
|
||||
#include <sstream>
|
||||
#include <Context.h>
|
||||
#include <Table.h>
|
||||
#include <format.h>
|
||||
#include <util.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdReports::CmdReports ()
|
||||
{
|
||||
_keyword = "reports";
|
||||
_usage = "task reports";
|
||||
_description = "Lists all supported reports";
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
_needs_gc = false;
|
||||
_uses_context = false;
|
||||
_accepts_filter = false;
|
||||
CmdReports::CmdReports() {
|
||||
_keyword = "reports";
|
||||
_usage = "task reports";
|
||||
_description = "Lists all supported reports";
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
_needs_gc = false;
|
||||
_uses_context = false;
|
||||
_accepts_filter = false;
|
||||
_accepts_modifications = false;
|
||||
_accepts_miscellaneous = false;
|
||||
_category = Command::Category::config;
|
||||
_category = Command::Category::config;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdReports::execute (std::string& output)
|
||||
{
|
||||
std::vector <std::string> reports;
|
||||
int CmdReports::execute(std::string& output) {
|
||||
std::vector<std::string> reports;
|
||||
|
||||
// Add custom reports.
|
||||
for (auto& i : Context::getContext ().config)
|
||||
{
|
||||
if (i.first.substr (0, 7) == "report.")
|
||||
{
|
||||
std::string report = i.first.substr (7);
|
||||
auto columns = report.find (".columns");
|
||||
if (columns != std::string::npos)
|
||||
reports.push_back (report.substr (0, columns));
|
||||
for (auto& i : Context::getContext().config) {
|
||||
if (i.first.substr(0, 7) == "report.") {
|
||||
std::string report = i.first.substr(7);
|
||||
auto columns = report.find(".columns");
|
||||
if (columns != std::string::npos) reports.push_back(report.substr(0, columns));
|
||||
}
|
||||
}
|
||||
|
||||
// Add known reports.
|
||||
reports.push_back ("burndown.daily");
|
||||
reports.push_back ("burndown.monthly");
|
||||
reports.push_back ("burndown.weekly");
|
||||
reports.push_back ("ghistory.annual");
|
||||
reports.push_back ("ghistory.monthly");
|
||||
reports.push_back ("history.annual");
|
||||
reports.push_back ("history.monthly");
|
||||
reports.push_back ("information");
|
||||
reports.push_back ("projects");
|
||||
reports.push_back ("summary");
|
||||
reports.push_back ("tags");
|
||||
reports.push_back("burndown.daily");
|
||||
reports.push_back("burndown.monthly");
|
||||
reports.push_back("burndown.weekly");
|
||||
reports.push_back("ghistory.annual");
|
||||
reports.push_back("ghistory.monthly");
|
||||
reports.push_back("history.annual");
|
||||
reports.push_back("history.monthly");
|
||||
reports.push_back("information");
|
||||
reports.push_back("projects");
|
||||
reports.push_back("summary");
|
||||
reports.push_back("tags");
|
||||
|
||||
std::sort (reports.begin (), reports.end ());
|
||||
std::sort(reports.begin(), reports.end());
|
||||
|
||||
// Compose the output.
|
||||
std::stringstream out;
|
||||
Table view;
|
||||
view.width (Context::getContext ().getWidth ());
|
||||
view.add ("Report");
|
||||
view.add ("Description");
|
||||
setHeaderUnderline (view);
|
||||
view.width(Context::getContext().getWidth());
|
||||
view.add("Report");
|
||||
view.add("Description");
|
||||
setHeaderUnderline(view);
|
||||
|
||||
for (auto& report : reports)
|
||||
{
|
||||
int row = view.addRow ();
|
||||
view.set (row, 0, report);
|
||||
view.set (row, 1, Context::getContext ().commands[report]->description ());
|
||||
for (auto& report : reports) {
|
||||
int row = view.addRow();
|
||||
view.set(row, 0, report);
|
||||
view.set(row, 1, Context::getContext().commands[report]->description());
|
||||
}
|
||||
|
||||
out << optionalBlankLine ()
|
||||
<< view.render ()
|
||||
<< optionalBlankLine ()
|
||||
<< format ("{1} reports\n", reports.size ());
|
||||
out << optionalBlankLine() << view.render() << optionalBlankLine()
|
||||
<< format("{1} reports\n", reports.size());
|
||||
|
||||
output = out.str ();
|
||||
output = out.str();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue