aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-04 01:22:04 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-04 01:22:04 +0000
commite9348bc25b1b460ed815c0efe354688c2bbb4518 (patch)
tree8ac9b39f9b9d3021d4da353f11c518b5461a00dc
parent759aa5dea6a98810bec616f61d4846dee268c8d7 (diff)
downloadpaludis-e9348bc25b1b460ed815c0efe354688c2bbb4518.tar.gz
paludis-e9348bc25b1b460ed815c0efe354688c2bbb4518.tar.xz
Add --quiet option to qualudis
-rw-r--r--src/qualudis/qualudis.cc50
-rw-r--r--src/qualudis/qualudis_command_line.cc1
-rw-r--r--src/qualudis/qualudis_command_line.hh3
3 files changed, 38 insertions, 16 deletions
diff --git a/src/qualudis/qualudis.cc b/src/qualudis/qualudis.cc
index 82f3a2e..fa53ed9 100644
--- a/src/qualudis/qualudis.cc
+++ b/src/qualudis/qualudis.cc
@@ -58,9 +58,32 @@ namespace
{
};
+ static std::string current_entry_heading;
+
+ void
+ need_entry_heading()
+ {
+ static std::string last_displayed_entry_heading;
+ if (last_displayed_entry_heading != current_entry_heading)
+ {
+ cout << endl;
+ cout << current_entry_heading << endl;
+ last_displayed_entry_heading = current_entry_heading;
+ }
+ }
+
+ void
+ set_entry_heading(const std::string & s)
+ {
+ current_entry_heading = s;
+ if (! QualudisCommandLine::get_instance()->a_quiet.specified())
+ need_entry_heading();
+ }
+
void
display_header(const qa::CheckResult & r)
{
+ need_entry_heading();
cout << r.item() << ": " << r.rule() << ":" << endl;
}
@@ -212,12 +235,14 @@ namespace
}
catch (const Exception & e)
{
+ need_entry_heading();
std::cout << "Eek! Caught Exception '" << e.message() << "' (" << e.what()
<< ") when doing check '" << *i << "'" << endl;
ok = false;
}
catch (const std::exception & e)
{
+ need_entry_heading();
std::cout << "Eek! Caught std::exception '" << e.what()
<< "' when doing check '" << *i << "'" << endl;
ok = false;
@@ -230,11 +255,11 @@ namespace
{
Context context("When checking package '" + stringify(dir) + "':");
cerr << xterm_title("Checking " + dir.dirname().basename() + "/" +
- dir.basename() + " - qualudis");
+ dir.basename() + " - qualudis") << std::flush;
bool ok(true), fatal(false);
- cout << "QA checks for package directory " << dir << ":" << endl;
+ set_entry_heading("QA checks for package directory " + stringify(dir) + ":");
if (! fatal)
do_check_kind<qa::PackageDirCheckMaker>(ok, fatal, dir);
@@ -297,7 +322,6 @@ namespace
cout << endl;
}
}
- cout << endl;
return ok;
}
@@ -307,10 +331,9 @@ namespace
{
Context context("When checking category '" + stringify(dir) + "':");
- cerr << xterm_title("Checking " + dir.basename() + " - qualudis");
+ cerr << xterm_title("Checking " + dir.basename() + " - qualudis") << std::flush;
- cout << "QA checks for category directory " << dir << ":" << endl;
- cout << endl;
+ set_entry_heading("QA checks for category directory " + stringify(dir) + ":");
bool ok(true);
@@ -326,12 +349,10 @@ namespace
{
bool fatal(false);
- cout << "QA checks for category file " << *d << ":" << endl;
+ set_entry_heading("QA checks for category file " + stringify(*d) + ":");
do_check_kind<qa::FileCheckMaker>(ok, fatal, *d);
- cout << endl;
-
if (fatal)
break;
}
@@ -345,10 +366,9 @@ namespace
{
Context context("When checking eclass directory '" + stringify(dir) + "':");
- cerr << xterm_title("Checking " + dir.basename() + " - qualudis");
+ cerr << xterm_title("Checking " + dir.basename() + " - qualudis") << std::flush;
- cout << "QA checks for eclass directory " << dir << ":" << endl;
- cout << endl;
+ set_entry_heading("QA checks for eclass directory " + stringify(dir) + ":");
bool ok(true);
@@ -362,12 +382,10 @@ namespace
{
bool fatal(false);
- cout << "QA checks for eclass file " << *d << ":" << endl;
+ set_entry_heading("QA checks for eclass file " + stringify(*d) + ":");
do_check_kind<qa::FileCheckMaker>(ok, fatal, *d);
- cout << endl;
-
if (fatal)
break;
}
@@ -381,7 +399,7 @@ namespace
{
Context context("When checking top level '" + stringify(dir) + "':");
- cout << "QA checks for top level directory " << dir << ":" << endl << endl;
+ set_entry_heading("QA checks for top level directory " + stringify(dir) + ":");
qa::QAEnvironment env(dir);
bool ok(true);
diff --git a/src/qualudis/qualudis_command_line.cc b/src/qualudis/qualudis_command_line.cc
index 00e6eb5..4869249 100644
--- a/src/qualudis/qualudis_command_line.cc
+++ b/src/qualudis/qualudis_command_line.cc
@@ -35,6 +35,7 @@ QualudisCommandLine::QualudisCommandLine() :
"Options relevant for the --owner actions."),
a_qa_checks(&check_options, "qa-check", 'c', "Only perform given check."),
a_verbose(&check_options, "verbose", 'v', "Be verbose"),
+ a_quiet(&check_options, "quiet", 'q', "Be quiet"),
a_log_level(&check_options, "log-level", 'L', "Specify the log level",
paludis::args::EnumArg::EnumArgOptions("debug", "Show debug output (noisy)")
("qa", "Show QA messages and warnings only")
diff --git a/src/qualudis/qualudis_command_line.hh b/src/qualudis/qualudis_command_line.hh
index ed2c1af..e16f3d2 100644
--- a/src/qualudis/qualudis_command_line.hh
+++ b/src/qualudis/qualudis_command_line.hh
@@ -59,6 +59,9 @@ class QualudisCommandLine :
/// --verbose
paludis::args::SwitchArg a_verbose;
+ /// --quiet
+ paludis::args::SwitchArg a_quiet;
+
/// --log-level
paludis::args::EnumArg a_log_level;