mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 06:37:20 +02:00
- Fixed bug #552, where 'rc.verbose=off' suppressed warnings (thanks to Peter De Poorter). - Fixed bug #863, which suppressed report labels with rc.verbose=off (thanks to Michelle Crane).
This commit is contained in:
parent
45dba8805c
commit
824cba7152
6 changed files with 101 additions and 26 deletions
|
@ -132,6 +132,8 @@
|
||||||
variable forces taskwarrior to never use the last column.
|
variable forces taskwarrior to never use the last column.
|
||||||
+ Fixed bugs #533 and #536, which prevented having correct paths for themes
|
+ Fixed bugs #533 and #536, which prevented having correct paths for themes
|
||||||
in .taskrc (thanks to Juergen Daubert)
|
in .taskrc (thanks to Juergen Daubert)
|
||||||
|
+ Fixed bug #552, where 'rc.verbose=off' suppressed warnings (thanks to Peter
|
||||||
|
De Poorter).
|
||||||
+ Fixed bug #594, which broke the 'all' report with a combination of bad regex
|
+ Fixed bug #594, which broke the 'all' report with a combination of bad regex
|
||||||
handling and a formatting bug (thanks to Steve Rader).
|
handling and a formatting bug (thanks to Steve Rader).
|
||||||
+ Fixed bug #605, which gave misleading project completion percentages under
|
+ Fixed bug #605, which gave misleading project completion percentages under
|
||||||
|
@ -240,6 +242,8 @@
|
||||||
+ Fixed bug #860, which prevented lower-case priority values from being
|
+ Fixed bug #860, which prevented lower-case priority values from being
|
||||||
accepted (thanks to Michelle Crane).
|
accepted (thanks to Michelle Crane).
|
||||||
+ Fixed bug #862, which suppressed feedback from the 'denotate' command.
|
+ Fixed bug #862, which suppressed feedback from the 'denotate' command.
|
||||||
|
+ Fixed bug #863, which suppressed report labels with rc.verbose=off (thanks to
|
||||||
|
Michelle Crane).
|
||||||
+ Fixed bug #879, which mis-parsed escaped characters in the data file (thanks
|
+ Fixed bug #879, which mis-parsed escaped characters in the data file (thanks
|
||||||
to Michelle Crane).
|
to Michelle Crane).
|
||||||
+ Fixed bug #880, which listed the wrong file paths for themes (thanks to Peter
|
+ Fixed bug #880, which listed the wrong file paths for themes (thanks to Peter
|
||||||
|
|
|
@ -79,8 +79,9 @@ std::string Config::_defaults =
|
||||||
"\n"
|
"\n"
|
||||||
"# Miscellaneous\n"
|
"# Miscellaneous\n"
|
||||||
"verbose=yes # Provide maximal feedback\n"
|
"verbose=yes # Provide maximal feedback\n"
|
||||||
"#verbose=no # Provide minimal feedback\n"
|
"#verbose=no # Provide regular feedback\n"
|
||||||
"#verbose=list # Comma-separated list. May contain any subset of:\n"
|
"#verbose=nothing # Provide no feedback\n"
|
||||||
|
"# # Comma-separated list. May contain any subset of:\n"
|
||||||
"#verbose=blank,header,footnote,label,new-id,affected,edit,special\n"
|
"#verbose=blank,header,footnote,label,new-id,affected,edit,special\n"
|
||||||
"confirmation=yes # Confirmation on delete, big changes\n"
|
"confirmation=yes # Confirmation on delete, big changes\n"
|
||||||
"annotations=full # Level of verbosity for annotations: full, sparse or none\n"
|
"annotations=full # Level of verbosity for annotations: full, sparse or none\n"
|
||||||
|
@ -654,15 +655,15 @@ const bool Config::getBoolean (const std::string& key)
|
||||||
if ((*this).find (key) != (*this).end ())
|
if ((*this).find (key) != (*this).end ())
|
||||||
{
|
{
|
||||||
std::string value = lowerCase ((*this)[key]);
|
std::string value = lowerCase ((*this)[key]);
|
||||||
if (value == "t" ||
|
if (value == "t" || // TODO Deprecate
|
||||||
value == "true" ||
|
value == "true" ||
|
||||||
value == "1" ||
|
value == "1" ||
|
||||||
value == "+" ||
|
value == "+" || // TODO Deprecate
|
||||||
value == "y" ||
|
value == "y" ||
|
||||||
value == "yes" ||
|
value == "yes" ||
|
||||||
value == "on" ||
|
value == "on" ||
|
||||||
value == "enable" ||
|
value == "enable" || // TODO Deprecate
|
||||||
value == "enabled")
|
value == "enabled") // TODO Deprecate
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,15 +179,15 @@ int Context::initialize (int argc, const char** argv)
|
||||||
hooks.trigger ("on-launch");
|
hooks.trigger ("on-launch");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (const std::string& error)
|
catch (const std::string& message)
|
||||||
{
|
{
|
||||||
footnote (error);
|
error (message);
|
||||||
rc = 2;
|
rc = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
footnote (STRING_UNKNOWN_ERROR);
|
error (STRING_UNKNOWN_ERROR);
|
||||||
rc = 3;
|
rc = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +224,18 @@ int Context::initialize (int argc, const char** argv)
|
||||||
std::cout << *f << "\n";
|
std::cout << *f << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dump all errors, non-maskable.
|
||||||
|
// Colorized as footnotes.
|
||||||
|
if (rc)
|
||||||
|
{
|
||||||
|
std::vector <std::string>::iterator e;
|
||||||
|
for (e = errors.begin (); e != errors.end (); ++e)
|
||||||
|
if (color ())
|
||||||
|
std::cout << colorizeFootnote (*e) << "\n";
|
||||||
|
else
|
||||||
|
std::cout << *e << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
timer_init.stop ();
|
timer_init.stop ();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -270,15 +282,15 @@ int Context::run ()
|
||||||
debug (s.str ());
|
debug (s.str ());
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (const std::string& error)
|
catch (const std::string& message)
|
||||||
{
|
{
|
||||||
footnote (error);
|
error (message);
|
||||||
rc = 2;
|
rc = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
footnote (STRING_UNKNOWN_ERROR);
|
error (STRING_UNKNOWN_ERROR);
|
||||||
rc = 3;
|
rc = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,6 +330,15 @@ int Context::run ()
|
||||||
std::cout << *f << "\n";
|
std::cout << *f << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dump all errors, non-maskable.
|
||||||
|
// Colorized as footnotes.
|
||||||
|
std::vector <std::string>::iterator e;
|
||||||
|
for (e = errors.begin (); e != errors.end (); ++e)
|
||||||
|
if (color ())
|
||||||
|
std::cout << colorizeFootnote (*e) << "\n";
|
||||||
|
else
|
||||||
|
std::cout << *e << "\n";
|
||||||
|
|
||||||
hooks.trigger ("on-exit");
|
hooks.trigger ("on-exit");
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -402,17 +423,56 @@ bool Context::color ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// TODO Support verbosity levels.
|
// Support verbosity levels:
|
||||||
|
//
|
||||||
|
// rc.verbose=1 Show all feedback.
|
||||||
|
// rc.verbose=0 Show regular feedback.
|
||||||
|
// rc.verbose=nothing Show the absolute minimum.
|
||||||
|
// rc.verbose=one,two Show verbosity for 'one' and 'two' only.
|
||||||
|
//
|
||||||
bool Context::verbose (const std::string& token)
|
bool Context::verbose (const std::string& token)
|
||||||
{
|
{
|
||||||
if (! verbosity.size ())
|
if (! verbosity.size ())
|
||||||
{
|
{
|
||||||
verbosity_legacy = config.getBoolean ("verbose");
|
verbosity_legacy = config.getBoolean ("verbose");
|
||||||
split (verbosity, config.get ("verbose"), ',');
|
split (verbosity, config.get ("verbose"), ',');
|
||||||
|
|
||||||
|
// Regular feedback means almost everything.
|
||||||
|
if (!verbosity_legacy &&
|
||||||
|
verbosity.size () == 1 &&
|
||||||
|
verbosity[0] != "nothing" &&
|
||||||
|
verbosity[0] != "blank" && // This list must be complete.
|
||||||
|
verbosity[0] != "header" && //
|
||||||
|
verbosity[0] != "footnote" && //
|
||||||
|
verbosity[0] != "label" && //
|
||||||
|
verbosity[0] != "new-id" && //
|
||||||
|
verbosity[0] != "affected" && //
|
||||||
|
verbosity[0] != "edit" && //
|
||||||
|
verbosity[0] != "special") //
|
||||||
|
{
|
||||||
|
verbosity.clear ();
|
||||||
|
|
||||||
|
// This list emulates rc.verbose=off in version 1.9.4.
|
||||||
|
verbosity.push_back ("blank");
|
||||||
|
verbosity.push_back ("footnote");
|
||||||
|
verbosity.push_back ("label");
|
||||||
|
verbosity.push_back ("new-id");
|
||||||
|
verbosity.push_back ("affected");
|
||||||
|
verbosity.push_back ("edit");
|
||||||
|
verbosity.push_back ("special");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbosity_legacy ||
|
// rc.verbose=true|y|yes|1|on overrides all.
|
||||||
std::find (verbosity.begin (), verbosity.end (), token) != verbosity.end ())
|
if (verbosity_legacy)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// rc.verbose=nothing overrides all.
|
||||||
|
if (verbosity[0] == "nothing")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Specific token match.
|
||||||
|
if (std::find (verbosity.begin (), verbosity.end (), token) != verbosity.end ())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -625,6 +685,13 @@ void Context::footnote (const std::string& input)
|
||||||
footnotes.push_back (input);
|
footnotes.push_back (input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void Context::error (const std::string& input)
|
||||||
|
{
|
||||||
|
if (input.length ())
|
||||||
|
errors.push_back (input);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Context::debug (const std::string& input)
|
void Context::debug (const std::string& input)
|
||||||
{
|
{
|
||||||
|
@ -636,6 +703,7 @@ void Context::clearMessages ()
|
||||||
{
|
{
|
||||||
headers.clear ();
|
headers.clear ();
|
||||||
footnotes.clear ();
|
footnotes.clear ();
|
||||||
|
errors.clear ();
|
||||||
debugMessages.clear ();
|
debugMessages.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ public:
|
||||||
void header (const std::string&); // Header message sink
|
void header (const std::string&); // Header message sink
|
||||||
void footnote (const std::string&); // Footnote message sink
|
void footnote (const std::string&); // Footnote message sink
|
||||||
void debug (const std::string&); // Debug message sink
|
void debug (const std::string&); // Debug message sink
|
||||||
|
void error (const std::string&); // Error message sink - non-maskable
|
||||||
void clearMessages ();
|
void clearMessages ();
|
||||||
void clear ();
|
void clear ();
|
||||||
|
|
||||||
|
@ -101,6 +102,7 @@ public:
|
||||||
std::vector <std::string> verbosity;
|
std::vector <std::string> verbosity;
|
||||||
std::vector <std::string> headers;
|
std::vector <std::string> headers;
|
||||||
std::vector <std::string> footnotes;
|
std::vector <std::string> footnotes;
|
||||||
|
std::vector <std::string> errors;
|
||||||
std::vector <std::string> debugMessages;
|
std::vector <std::string> debugMessages;
|
||||||
/*
|
/*
|
||||||
bool inShadow;
|
bool inShadow;
|
||||||
|
|
|
@ -129,11 +129,12 @@ int CmdCustom::execute (std::string& output)
|
||||||
|
|
||||||
// How many lines taken up by table header?
|
// How many lines taken up by table header?
|
||||||
// TODO Consider rc.verbose
|
// TODO Consider rc.verbose
|
||||||
int table_header;
|
int table_header = 0;
|
||||||
if (context.color () && context.config.getBoolean ("fontunderline"))
|
if (context.verbose ("label"))
|
||||||
table_header = 1; // Underlining doesn't use extra line.
|
if (context.color () && context.config.getBoolean ("fontunderline"))
|
||||||
else
|
table_header = 1; // Underlining doesn't use extra line.
|
||||||
table_header = 2; // Dashes use an extra line.
|
else
|
||||||
|
table_header = 2; // Dashes use an extra line.
|
||||||
|
|
||||||
// Report output can be limited by rows or lines.
|
// Report output can be limited by rows or lines.
|
||||||
int maxrows = 0;
|
int maxrows = 0;
|
||||||
|
@ -141,15 +142,13 @@ int CmdCustom::execute (std::string& output)
|
||||||
getLimits (_keyword, maxrows, maxlines);
|
getLimits (_keyword, maxrows, maxlines);
|
||||||
|
|
||||||
// Adjust for fluff in the output.
|
// Adjust for fluff in the output.
|
||||||
// TODO Consider rc.verbose
|
|
||||||
if (maxlines)
|
if (maxlines)
|
||||||
maxlines -= (context.verbose ("blank") ? 1 : 0)
|
maxlines -= (context.verbose ("blank") ? 1 : 0)
|
||||||
+ table_header
|
+ table_header
|
||||||
+ context.footnotes.size ()
|
+ (context.verbose ("footnote") ? context.footnotes.size () : 0)
|
||||||
+ 1; // "X tasks shown ..."
|
+ 1; // "X tasks shown ..."
|
||||||
|
|
||||||
// Render.
|
// Render.
|
||||||
// TODO Consider rc.verbose
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
if (filtered.size ())
|
if (filtered.size ())
|
||||||
{
|
{
|
||||||
|
@ -174,7 +173,8 @@ int CmdCustom::execute (std::string& output)
|
||||||
out << ", "
|
out << ", "
|
||||||
<< format (STRING_CMD_CUSTOM_TRUNCATED, maxlines - table_header);
|
<< format (STRING_CMD_CUSTOM_TRUNCATED, maxlines - table_header);
|
||||||
|
|
||||||
out << "\n";
|
if (context.verbose ("affected"))
|
||||||
|
out << "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ if (open my $fh, '>', 'verbose.rc')
|
||||||
my $output = qx{../src/task rc:verbose.rc rc.verbose:new-id add Sample1};
|
my $output = qx{../src/task rc:verbose.rc rc.verbose:new-id add Sample1};
|
||||||
like ($output, qr/Created task \d/, '\'new-id\' verbosity good');
|
like ($output, qr/Created task \d/, '\'new-id\' verbosity good');
|
||||||
|
|
||||||
$output = qx{../src/task rc:verbose.rc rc.verbose:off add Sample2};
|
$output = qx{../src/task rc:verbose.rc rc.verbose:nothing add Sample2};
|
||||||
unlike ($output, qr/Created task \d/, '\'new-id\' verbosity good');
|
unlike ($output, qr/Created task \d/, '\'new-id\' verbosity good');
|
||||||
|
|
||||||
# Verbosity: 'label'
|
# Verbosity: 'label'
|
||||||
|
@ -55,7 +55,7 @@ $output = qx{../src/task rc:verbose.rc ls rc.verbose:affected};
|
||||||
like ($output, qr/^\d+ tasks$/ms, '\'affected\' verbosity good');
|
like ($output, qr/^\d+ tasks$/ms, '\'affected\' verbosity good');
|
||||||
|
|
||||||
# Off
|
# Off
|
||||||
$output = qx{../src/task rc:verbose.rc ls rc.verbose:off};
|
$output = qx{../src/task rc:verbose.rc ls rc.verbose:nothing};
|
||||||
unlike ($output, qr/^\d+ tasks$/ms, '\'affected\' verbosity good');
|
unlike ($output, qr/^\d+ tasks$/ms, '\'affected\' verbosity good');
|
||||||
unlike ($output, qr/ID.+Project.+Pri.+Description/, '\'label\' verbosity good');
|
unlike ($output, qr/ID.+Project.+Pri.+Description/, '\'label\' verbosity good');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue