mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Verbose
- Implemented rc.verbose=on|off|list... - Migrated rc.blanklines to a verbosity token. - Updated documentation.
This commit is contained in:
parent
adc8605b06
commit
5fa77a36de
12 changed files with 65 additions and 13 deletions
|
@ -70,6 +70,8 @@ std::string Config::defaults =
|
|||
"\n"
|
||||
"# Miscellaneous\n"
|
||||
"verbose=yes # Provide extra feedback\n"
|
||||
"#verbose=no # Provide minimal feedback\n"
|
||||
"#verbose=blanklines # Provide controlled feedback\n"
|
||||
"confirmation=yes # Confirmation on delete, big changes\n"
|
||||
"echo.command=yes # Details on command just run\n"
|
||||
"annotations=full # Level of verbosity for annotations: full, sparse or none\n"
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -57,6 +58,7 @@ Context::Context ()
|
|||
, cmd ()
|
||||
, dom ()
|
||||
, use_color (true)
|
||||
, verbosity_legacy (false)
|
||||
, inShadow (false)
|
||||
, terminal_width (0)
|
||||
, terminal_height (0)
|
||||
|
@ -327,6 +329,24 @@ bool Context::color ()
|
|||
config.getBoolean ("_forcecolor");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Context::verbose (const std::string& token)
|
||||
{
|
||||
if (! verbosity.size ())
|
||||
{
|
||||
verbosity_legacy = config.getBoolean ("verbose");
|
||||
split (verbosity, config.get ("verbose"), ',');
|
||||
}
|
||||
|
||||
if (verbosity_legacy)
|
||||
return true;
|
||||
|
||||
if (std::find (verbosity.begin (), verbosity.end (), token) != verbosity.end ())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Context::shadow ()
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
int getHeight (); // determine terminal height
|
||||
|
||||
bool color (); // TTY or <other>?
|
||||
bool verbose (const std::string&); // Verbosity control
|
||||
|
||||
void header (const std::string&); // Header message sink
|
||||
void footnote (const std::string&); // Footnote message sink
|
||||
|
@ -101,6 +102,8 @@ public:
|
|||
DOM dom;
|
||||
bool use_color;
|
||||
|
||||
bool verbosity_legacy;
|
||||
std::vector <std::string> verbosity;
|
||||
std::vector <std::string> headers;
|
||||
std::vector <std::string> footnotes;
|
||||
std::vector <std::string> debugMessages;
|
||||
|
|
|
@ -216,7 +216,11 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
|||
out += headers[c][i];
|
||||
}
|
||||
|
||||
out += extra + "\n";
|
||||
out += extra;
|
||||
|
||||
// Trim right.
|
||||
out.erase (out.find_last_not_of (" ") + 1);
|
||||
out += "\n";
|
||||
|
||||
// Stop if the line limit is exceeded.
|
||||
if (++_lines >= _truncate_lines && _truncate_lines != 0)
|
||||
|
@ -269,7 +273,11 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
|||
out += row_color.colorize (std::string (widths[c], ' '));
|
||||
}
|
||||
|
||||
out += (odd ? extra_odd : extra_even) + "\n";
|
||||
out += (odd ? extra_odd : extra_even);
|
||||
|
||||
// Trim right.
|
||||
out.erase (out.find_last_not_of (" ") + 1);
|
||||
out += "\n";
|
||||
|
||||
// Stop if the line limit is exceeded.
|
||||
if (++_lines >= _truncate_lines && _truncate_lines != 0)
|
||||
|
|
|
@ -200,7 +200,11 @@ std::string ViewText::render ()
|
|||
out += headers[c][i];
|
||||
}
|
||||
|
||||
out += extra + "\n";
|
||||
out += extra;
|
||||
|
||||
// Trim right.
|
||||
out.erase (out.find_last_not_of (" ") + 1);
|
||||
out += "\n";
|
||||
|
||||
// Stop if the line limit is exceeded.
|
||||
if (++_lines >= _truncate_lines && _truncate_lines != 0)
|
||||
|
@ -256,7 +260,11 @@ std::string ViewText::render ()
|
|||
}
|
||||
}
|
||||
|
||||
out += (odd ? extra_odd : extra_even) + "\n";
|
||||
out += (odd ? extra_odd : extra_even);
|
||||
|
||||
// Trim right.
|
||||
out.erase (out.find_last_not_of (" ") + 1);
|
||||
out += "\n";
|
||||
|
||||
// Stop if the line limit is exceeded.
|
||||
if (++_lines >= _truncate_lines && _truncate_lines != 0)
|
||||
|
|
|
@ -1093,7 +1093,7 @@ int handleShow (std::string& outs)
|
|||
// Note that there is a leading and trailing space, to make it easier to
|
||||
// search for whole words.
|
||||
std::string recognized =
|
||||
" annotations blanklines bulk burndown.bias calendar.details calendar.details.report "
|
||||
" annotations bulk burndown.bias calendar.details calendar.details.report "
|
||||
"calendar.holidays calendar.legend color calendar.offset calendar.offset.value "
|
||||
"color.active color.due color.due.today color.blocked color.burndown.done "
|
||||
"color.burndown.pending color.burndown.started color.overdue color.pri.H "
|
||||
|
|
|
@ -269,7 +269,7 @@ int handleCustomReport (const std::string& report, std::string& outs)
|
|||
|
||||
// Adjust for fluff in the output.
|
||||
if (maxlines)
|
||||
maxlines -= (context.config.getBoolean ("blanklines") ? 1 : 0)
|
||||
maxlines -= (context.verbose ("blanklines") ? 1 : 0)
|
||||
+ table_header
|
||||
+ context.headers.size ()
|
||||
+ context.footnotes.size ();
|
||||
|
|
|
@ -402,10 +402,7 @@ std::string ucFirst (const std::string& input)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
const char* optionalBlankLine ()
|
||||
{
|
||||
if (context.config.getBoolean ("blanklines") == true) // no i18n
|
||||
return newline;
|
||||
|
||||
return noline;
|
||||
return context.verbose ("blanklines") ? newline : noline;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue