mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-29 17:07:19 +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;
|
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
|
// The 'Task' object, among others, is shared between projects. To make this
|
||||||
// easier, it has been decoupled from Context.
|
// easier, it has been decoupled from Context.
|
||||||
|
|
|
@ -59,6 +59,7 @@ public:
|
||||||
|
|
||||||
const std::vector <std::string> getColumns () const;
|
const std::vector <std::string> getColumns () const;
|
||||||
const std::vector <std::string> getCommands () const;
|
const std::vector <std::string> getCommands () const;
|
||||||
|
void getLimits (int&, int&);
|
||||||
|
|
||||||
bool color (); // TTY or <other>?
|
bool color (); // TTY or <other>?
|
||||||
bool verbose (const std::string&); // Verbosity control
|
bool verbose (const std::string&); // Verbosity control
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue