aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-16 17:13:26 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-16 17:13:26 +0000
commitbf42f82637341863181ef31d1b91aac39c5410f9 (patch)
tree047587a110a408f57eebe62a3afe050d10b060e9
parent760ae661062cf534fd535d98c0cedd47e72cfa54 (diff)
downloadpaludis-bf42f82637341863181ef31d1b91aac39c5410f9.tar.gz
paludis-bf42f82637341863181ef31d1b91aac39c5410f9.tar.xz
Add --message-level, default to info
-rw-r--r--src/qualudis/qualudis.cc16
-rw-r--r--src/qualudis/qualudis_command_line.cc11
-rw-r--r--src/qualudis/qualudis_command_line.hh6
3 files changed, 32 insertions, 1 deletions
diff --git a/src/qualudis/qualudis.cc b/src/qualudis/qualudis.cc
index 8afc1f5..01d2bc1 100644
--- a/src/qualudis/qualudis.cc
+++ b/src/qualudis/qualudis.cc
@@ -79,6 +79,9 @@ namespace
for (qa::CheckResult::Iterator i(r.begin()), i_end(r.end()) ; i != i_end ; ++i)
{
+ if (i->get<qa::mk_level>() < QualudisCommandLine::get_instance()->message_level)
+ continue;
+
bool show(true);
do
{
@@ -284,6 +287,19 @@ int main(int argc, char *argv[])
else
throw DoHelp("bad value for --log-level");
+ if (! QualudisCommandLine::get_instance()->a_message_level.specified())
+ QualudisCommandLine::get_instance()->message_level = qa::qal_info;
+ else if (QualudisCommandLine::get_instance()->a_message_level.argument() == "info")
+ QualudisCommandLine::get_instance()->message_level = qa::qal_info;
+ else if (QualudisCommandLine::get_instance()->a_message_level.argument() == "minor")
+ QualudisCommandLine::get_instance()->message_level = qa::qal_minor;
+ else if (QualudisCommandLine::get_instance()->a_message_level.argument() == "major")
+ QualudisCommandLine::get_instance()->message_level = qa::qal_major;
+ else if (QualudisCommandLine::get_instance()->a_message_level.argument() == "fatal")
+ QualudisCommandLine::get_instance()->message_level = qa::qal_fatal;
+ else
+ throw DoHelp("bad value for --message-level");
+
if (QualudisCommandLine::get_instance()->a_version.specified())
throw DoVersion();
diff --git a/src/qualudis/qualudis_command_line.cc b/src/qualudis/qualudis_command_line.cc
index 4401a3a..585866d 100644
--- a/src/qualudis/qualudis_command_line.cc
+++ b/src/qualudis/qualudis_command_line.cc
@@ -34,7 +34,16 @@ QualudisCommandLine::QualudisCommandLine() :
paludis::args::EnumArg::EnumArgOptions("debug", "Show debug output (noisy)")
("warning", "Show warnings only")
("silent", "Suppress all log messages"),
- "warning")
+ "warning"),
+
+ a_message_level(&check_options, "message-level", 'M', "Specify the message level",
+ paludis::args::EnumArg::EnumArgOptions("info", "Show info and upwards")
+ ("minor", "Show minor and upwards")
+ ("major", "Show major and upwards")
+ ("fatal", "Show only fatals"),
+ "warning"),
+
+ message_level(paludis::qa::qal_info)
{
}
diff --git a/src/qualudis/qualudis_command_line.hh b/src/qualudis/qualudis_command_line.hh
index 7f4c8c1..73a7c88 100644
--- a/src/qualudis/qualudis_command_line.hh
+++ b/src/qualudis/qualudis_command_line.hh
@@ -4,6 +4,7 @@
#define PALUDIS_GUARD_SRC_QUALUDIS_QUALUDIS_COMMAND_LINE_HH 1
#include <paludis/args/args.hh>
+#include <paludis/qa/qa.hh>
#include <paludis/instantiation_policy.hh>
class QualudisCommandLine :
@@ -52,6 +53,11 @@ class QualudisCommandLine :
/// --log-level
paludis::args::EnumArg a_log_level;
+ /// --message-level
+ paludis::args::EnumArg a_message_level;
+
+ paludis::qa::QALevel message_level;
+
///}
};