aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-07 01:25:51 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-07 01:25:51 +0000
commitf33acc94ef72bb4c0aebf79fe4393d4aa308f686 (patch)
treecdc0976e7a60ff3e61d70343ea10af8f1fdde60a
parentff8a2c2894bc88278fea2e114ead3143be8696ff (diff)
downloadpaludis-f33acc94ef72bb4c0aebf79fe4393d4aa308f686.tar.gz
paludis-f33acc94ef72bb4c0aebf79fe4393d4aa308f686.tar.xz
Add --show-associated-keys argument to qualudis.
-rw-r--r--src/clients/qualudis/qualudis.cc20
-rw-r--r--src/clients/qualudis/qualudis_command_line.cc8
-rw-r--r--src/clients/qualudis/qualudis_command_line.hh3
3 files changed, 23 insertions, 8 deletions
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index 58ae97c..131f7ec 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -172,11 +172,14 @@ namespace
FSEntry previous_entry;
std::string previous_name;
+ bool show_keys, show_keys_once;
std::set<const MetadataKey *> printed_keys;
- QualudisReporter() :
+ QualudisReporter(const std::string & show_associated_keys) :
previous_entry("/NONE"),
- previous_name("NONE")
+ previous_name("NONE"),
+ show_keys("never" != show_associated_keys),
+ show_keys_once("once" == show_associated_keys)
{
}
@@ -233,14 +236,17 @@ namespace
std::cout << " " << stringify(**i) << std::endl;
}
- if (! msg.associated_keys->empty())
+ if (show_keys && ! msg.associated_keys->empty())
{
for (QAMessage::KeysSequence::ConstIterator i(msg.associated_keys->begin()),
i_end(msg.associated_keys->end()) ; i != i_end ; ++i)
{
- if (printed_keys.end() != printed_keys.find(&**i))
- continue;
- printed_keys.insert(&**i);
+ if (show_keys_once)
+ {
+ if (printed_keys.end() != printed_keys.find(&**i))
+ continue;
+ printed_keys.insert(&**i);
+ }
MetadataKeyPrettyPrinter pp;
(*i)->accept(pp);
@@ -315,7 +321,7 @@ int main(int argc, char *argv[])
if (! env->main_repository()->qa_interface)
throw ConfigurationError("Repository '" + stringify(env->main_repository()->name()) + "' does not support QA checks");
- QualudisReporter r;
+ QualudisReporter r(QualudisCommandLine::get_instance()->a_show_associated_keys.argument());
if (QualudisCommandLine::get_instance()->empty())
{
env->main_repository()->qa_interface->check_qa(
diff --git a/src/clients/qualudis/qualudis_command_line.cc b/src/clients/qualudis/qualudis_command_line.cc
index c75bc16..9f31266 100644
--- a/src/clients/qualudis/qualudis_command_line.cc
+++ b/src/clients/qualudis/qualudis_command_line.cc
@@ -45,9 +45,15 @@ QualudisCommandLine::QualudisCommandLine() :
("normal", "Show normal and upwards")
("severe", "Show severe and upwards"),
"maybe"),
-
message_level(paludis::qaml_maybe),
+ a_show_associated_keys(&check_options, "show-associated-keys", '\0', "Show the contents of relevant metadata keys",
+ paludis::args::EnumArg::EnumArgOptions
+ ("never", "Never show metadata keys")
+ ("once", "Show each metadata key at most once")
+ ("always", "Always show metadata keys"),
+ "once"),
+
configuration_options(this, "Configuration options",
"Options that control general configuration."),
a_write_cache_dir(&configuration_options, "write-cache-dir", '\0',
diff --git a/src/clients/qualudis/qualudis_command_line.hh b/src/clients/qualudis/qualudis_command_line.hh
index 9d99e58..149c2c2 100644
--- a/src/clients/qualudis/qualudis_command_line.hh
+++ b/src/clients/qualudis/qualudis_command_line.hh
@@ -59,6 +59,9 @@ class QualudisCommandLine :
paludis::QAMessageLevel message_level;
+ /// --show-associated-keys
+ paludis::args::EnumArg a_show_associated_keys;
+
///\}
///\name Configuration options