mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Limits
- Implemented built-in support for limits.
This commit is contained in:
parent
9603864924
commit
b70fa61f34
3 changed files with 25 additions and 8 deletions
|
@ -634,6 +634,17 @@ bool Arguments::find_command (std::string& command)
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Arguments::find_limit ()
|
||||
{
|
||||
std::vector <std::pair <std::string, std::string> >::iterator arg;
|
||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||
if (arg->first.find ("limit:") != std::string::npos)
|
||||
return arg->first.substr (6);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Arguments::is_multipart (
|
||||
const std::string& input,
|
||||
|
@ -1316,7 +1327,9 @@ Arguments Arguments::extract_read_only_filter ()
|
|||
i->second == "exp" ||
|
||||
i->second == "word")
|
||||
{
|
||||
filter.push_back (*i);
|
||||
// "limit" is special - it is recognized but not included in filters.
|
||||
if (i->first.find ("limit:") == std::string::npos)
|
||||
filter.push_back (*i);
|
||||
}
|
||||
|
||||
// Error.
|
||||
|
@ -1362,7 +1375,9 @@ Arguments Arguments::extract_write_filter ()
|
|||
i->second == "exp" ||
|
||||
i->second == "word")
|
||||
{
|
||||
filter.push_back (*i);
|
||||
// "limit" is special - it is recognized but not included in filters.
|
||||
if (i->first.find ("limit:") == std::string::npos)
|
||||
filter.push_back (*i);
|
||||
}
|
||||
|
||||
// Error.
|
||||
|
@ -1409,7 +1424,9 @@ Arguments Arguments::extract_modifications ()
|
|||
i->second == "op" ||
|
||||
i->second == "word")
|
||||
{
|
||||
modifications.push_back (*i);
|
||||
// "limit" is special - it is recognized but not included in filters.
|
||||
if (i->first.find ("limit:") == std::string::npos)
|
||||
modifications.push_back (*i);
|
||||
}
|
||||
|
||||
// Error.
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
std::string combine ();
|
||||
|
||||
bool find_command (std::string&);
|
||||
std::string find_limit ();
|
||||
|
||||
static bool is_multipart (const std::string&, std::vector <std::string>&);
|
||||
static bool is_command (const std::vector <std::string>&, std::string&);
|
||||
|
|
|
@ -277,10 +277,10 @@ void CmdCustom::getLimits (const std::string& report, int& rows, int& lines)
|
|||
|
||||
// If the custom report has a defined limit, then allow a numeric override.
|
||||
// This is an integer specified as a filter (limit:10).
|
||||
/*
|
||||
if (context.task.has ("limit"))
|
||||
std::string limit = context.args.find_limit ();
|
||||
if (limit != "")
|
||||
{
|
||||
if (context.task.get ("limit") == "page")
|
||||
if (limit == "page")
|
||||
{
|
||||
if (screenheight == 0)
|
||||
screenheight = context.getHeight ();
|
||||
|
@ -290,11 +290,10 @@ void CmdCustom::getLimits (const std::string& report, int& rows, int& lines)
|
|||
}
|
||||
else
|
||||
{
|
||||
rows = atoi (context.task.get ("limit").c_str ());
|
||||
rows = (int) strtol (limit.c_str (), NULL, 10);
|
||||
lines = 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue