mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 04:13:07 +02:00
Code Cleanup
- Eliminated several parse.cpp functions. - Implemented missing Cmd::allCustomReports.
This commit is contained in:
parent
9a94ea963c
commit
6066fa51ba
5 changed files with 11 additions and 44 deletions
|
|
@ -167,3 +167,9 @@ void Cmd::loadCustomReports ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void Cmd::allCustomReports (std::vector <std::string>& all) const
|
||||||
|
{
|
||||||
|
all = customReports;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,10 @@ public:
|
||||||
Cmd (const std::string&); // Default constructor
|
Cmd (const std::string&); // Default constructor
|
||||||
~Cmd (); // Destructor
|
~Cmd (); // Destructor
|
||||||
|
|
||||||
bool valid (const std::string&);
|
bool valid (const std::string&);
|
||||||
bool validCustom (const std::string&);
|
bool validCustom (const std::string&);
|
||||||
void parse (const std::string&);
|
void parse (const std::string&);
|
||||||
|
void allCustomReports (std::vector <std::string>&) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string command;
|
std::string command;
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,6 @@ bool validPriority (const std::string&);
|
||||||
bool validDate (std::string&);
|
bool validDate (std::string&);
|
||||||
bool validDuration (std::string&);
|
bool validDuration (std::string&);
|
||||||
bool validDescription (const std::string&);
|
bool validDescription (const std::string&);
|
||||||
bool validCommand (std::string&);
|
|
||||||
void loadCustomReports ();
|
|
||||||
bool isCustomReport (const std::string&);
|
|
||||||
void allCustomReports (std::vector <std::string>&);
|
|
||||||
|
|
||||||
// task.cpp
|
// task.cpp
|
||||||
void gatherNextTasks (/*const TDB&,*/ T&, std::vector <T>&, std::vector <int>&);
|
void gatherNextTasks (/*const TDB&,*/ T&, std::vector <T>&, std::vector <int>&);
|
||||||
|
|
|
||||||
|
|
@ -554,40 +554,4 @@ void parse (
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void loadCustomReports ()
|
|
||||||
{
|
|
||||||
std::vector <std::string> all;
|
|
||||||
context.config.all (all);
|
|
||||||
|
|
||||||
foreach (i, all)
|
|
||||||
{
|
|
||||||
if (i->substr (0, 7) == "report.")
|
|
||||||
{
|
|
||||||
std::string report = i->substr (7, std::string::npos);
|
|
||||||
std::string::size_type columns = report.find (".columns");
|
|
||||||
if (columns != std::string::npos)
|
|
||||||
{
|
|
||||||
report = report.substr (0, columns);
|
|
||||||
customReports.push_back (report);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
bool isCustomReport (const std::string& report)
|
|
||||||
{
|
|
||||||
foreach (i, customReports)
|
|
||||||
if (*i == report)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void allCustomReports (std::vector <std::string>& all)
|
|
||||||
{
|
|
||||||
all = customReports;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ std::string shortUsage ()
|
||||||
|
|
||||||
// Add custom reports here...
|
// Add custom reports here...
|
||||||
std::vector <std::string> all;
|
std::vector <std::string> all;
|
||||||
allCustomReports (all);
|
context.cmd.allCustomReports (all);
|
||||||
foreach (report, all)
|
foreach (report, all)
|
||||||
{
|
{
|
||||||
std::string command = std::string ("task ") + *report + std::string (" [tags] [attrs] desc...");
|
std::string command = std::string ("task ") + *report + std::string (" [tags] [attrs] desc...");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue