- 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:
Paul Beckingham 2012-02-26 17:01:13 -05:00
parent 45dba8805c
commit 824cba7152
6 changed files with 101 additions and 26 deletions

View file

@ -132,6 +132,8 @@
variable forces taskwarrior to never use the last column.
+ Fixed bugs #533 and #536, which prevented having correct paths for themes
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
handling and a formatting bug (thanks to Steve Rader).
+ 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
accepted (thanks to Michelle Crane).
+ 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
to Michelle Crane).
+ Fixed bug #880, which listed the wrong file paths for themes (thanks to Peter

View file

@ -79,8 +79,9 @@ std::string Config::_defaults =
"\n"
"# Miscellaneous\n"
"verbose=yes # Provide maximal feedback\n"
"#verbose=no # Provide minimal feedback\n"
"#verbose=list # Comma-separated list. May contain any subset of:\n"
"#verbose=no # Provide regular feedback\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"
"confirmation=yes # Confirmation on delete, big changes\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 ())
{
std::string value = lowerCase ((*this)[key]);
if (value == "t" ||
if (value == "t" || // TODO Deprecate
value == "true" ||
value == "1" ||
value == "+" ||
value == "+" || // TODO Deprecate
value == "y" ||
value == "yes" ||
value == "on" ||
value == "enable" ||
value == "enabled")
value == "enable" || // TODO Deprecate
value == "enabled") // TODO Deprecate
return true;
}

View file

@ -179,15 +179,15 @@ int Context::initialize (int argc, const char** argv)
hooks.trigger ("on-launch");
}
catch (const std::string& error)
catch (const std::string& message)
{
footnote (error);
error (message);
rc = 2;
}
catch (...)
{
footnote (STRING_UNKNOWN_ERROR);
error (STRING_UNKNOWN_ERROR);
rc = 3;
}
@ -224,6 +224,18 @@ int Context::initialize (int argc, const char** argv)
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 ();
return rc;
}
@ -270,15 +282,15 @@ int Context::run ()
debug (s.str ());
}
catch (const std::string& error)
catch (const std::string& message)
{
footnote (error);
error (message);
rc = 2;
}
catch (...)
{
footnote (STRING_UNKNOWN_ERROR);
error (STRING_UNKNOWN_ERROR);
rc = 3;
}
@ -318,6 +330,15 @@ int Context::run ()
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");
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)
{
if (! verbosity.size ())
{
verbosity_legacy = config.getBoolean ("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 ||
std::find (verbosity.begin (), verbosity.end (), token) != verbosity.end ())
// rc.verbose=true|y|yes|1|on overrides all.
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 false;
@ -625,6 +685,13 @@ void Context::footnote (const std::string& 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)
{
@ -636,6 +703,7 @@ void Context::clearMessages ()
{
headers.clear ();
footnotes.clear ();
errors.clear ();
debugMessages.clear ();
}

View file

@ -68,6 +68,7 @@ public:
void header (const std::string&); // Header message sink
void footnote (const std::string&); // Footnote message sink
void debug (const std::string&); // Debug message sink
void error (const std::string&); // Error message sink - non-maskable
void clearMessages ();
void clear ();
@ -101,6 +102,7 @@ public:
std::vector <std::string> verbosity;
std::vector <std::string> headers;
std::vector <std::string> footnotes;
std::vector <std::string> errors;
std::vector <std::string> debugMessages;
/*
bool inShadow;

View file

@ -129,11 +129,12 @@ int CmdCustom::execute (std::string& output)
// How many lines taken up by table header?
// TODO Consider rc.verbose
int table_header;
if (context.color () && context.config.getBoolean ("fontunderline"))
table_header = 1; // Underlining doesn't use extra line.
else
table_header = 2; // Dashes use an extra line.
int table_header = 0;
if (context.verbose ("label"))
if (context.color () && context.config.getBoolean ("fontunderline"))
table_header = 1; // Underlining doesn't use extra line.
else
table_header = 2; // Dashes use an extra line.
// Report output can be limited by rows or lines.
int maxrows = 0;
@ -141,15 +142,13 @@ int CmdCustom::execute (std::string& output)
getLimits (_keyword, maxrows, maxlines);
// Adjust for fluff in the output.
// TODO Consider rc.verbose
if (maxlines)
maxlines -= (context.verbose ("blank") ? 1 : 0)
+ table_header
+ context.footnotes.size ()
+ (context.verbose ("footnote") ? context.footnotes.size () : 0)
+ 1; // "X tasks shown ..."
// Render.
// TODO Consider rc.verbose
std::stringstream out;
if (filtered.size ())
{
@ -174,7 +173,8 @@ int CmdCustom::execute (std::string& output)
out << ", "
<< format (STRING_CMD_CUSTOM_TRUNCATED, maxlines - table_header);
out << "\n";
if (context.verbose ("affected"))
out << "\n";
}
else
{

View file

@ -43,7 +43,7 @@ if (open my $fh, '>', 'verbose.rc')
my $output = qx{../src/task rc:verbose.rc rc.verbose:new-id add Sample1};
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');
# 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');
# 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/ID.+Project.+Pri.+Description/, '\'label\' verbosity good');