mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Context
- Added ::getLimits, copied from CmdCustom, for more general use.
This commit is contained in:
parent
fa58c24c66
commit
0cd56932a5
2 changed files with 27 additions and 0 deletions
|
@ -593,6 +593,32 @@ const std::vector <std::string> Context::getCommands () const
|
|||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// A value of zero mean unlimited.
|
||||
// A value of 'page' means however many screen lines there are.
|
||||
// A value of a positive integer is a row/task limit.
|
||||
void Context::getLimits (int& rows, int& lines)
|
||||
{
|
||||
rows = 0;
|
||||
lines = 0;
|
||||
|
||||
// This is an integer specified as a filter (limit:10).
|
||||
std::string limit = parser.getLimit ();
|
||||
if (limit != "")
|
||||
{
|
||||
if (limit == "page")
|
||||
{
|
||||
rows = 0;
|
||||
lines = getHeight ();
|
||||
}
|
||||
else
|
||||
{
|
||||
rows = (int) strtol (limit.c_str (), NULL, 10);
|
||||
lines = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The 'Task' object, among others, is shared between projects. To make this
|
||||
// easier, it has been decoupled from Context.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue