aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/clients/cave/cmd_display_resolution.cc6
-rw-r--r--src/clients/cave/cmd_info.cc6
-rw-r--r--src/clients/cave/cmd_match.cc10
-rw-r--r--src/clients/cave/cmd_show.cc12
-rw-r--r--src/clients/cave/colour_formatter-fmt.hh3
-rw-r--r--src/clients/cave/colour_formatter.cc6
-rw-r--r--src/clients/cave/colour_formatter.hh3
-rw-r--r--src/clients/cave/format_plain_metadata_key.cc6
-rw-r--r--src/clients/inquisitio/key_extractor.cc16
-rw-r--r--src/clients/instruo/instruo.cc5
-rw-r--r--src/clients/paludis/applets.cc6
-rw-r--r--src/clients/paludis/info.cc6
-rw-r--r--src/output/colour_formatter.cc6
-rw-r--r--src/output/colour_formatter.hh3
-rw-r--r--src/output/console_query_task.cc18
-rw-r--r--src/output/mask_displayer.cc6
16 files changed, 118 insertions, 0 deletions
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index d55fdbc05..5a29bec3d 100755
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -907,6 +907,12 @@ namespace
cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.pretty_print_flat(formatter))));
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ ColourFormatter formatter(0);
+ cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.pretty_print_flat(formatter))));
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter formatter(0);
diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc
index 6d84f3961..0a5e2bf14 100644
--- a/src/clients/cave/cmd_info.cc
+++ b/src/clients/cave/cmd_info.cc
@@ -167,6 +167,12 @@ namespace
cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(k.pretty_print_flat(f)));
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ ColourFormatter f(indent);
+ cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(k.pretty_print_flat(f)));
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter f(indent);
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index 1abf07409..220f150be 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -146,6 +146,11 @@ namespace
throw args::DoHelp("Unknown algoritm '" + algorithm + "'");
}
+ std::string stringify_string_pair(const std::pair<const std::string, std::string> & s)
+ {
+ return s.first + "=" + s.second;
+ }
+
struct SpecTreeAsString
{
std::list<std::string> & texts;
@@ -332,6 +337,11 @@ namespace
std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), &stringify<std::string>);
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), stringify_string_pair);
+ }
+
void visit(const MetadataCollectionKey<Set<KeywordName> > & k)
{
std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), &stringify<KeywordName>);
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index 4d433186f..796e56c7f 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -407,6 +407,18 @@ namespace
);
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ ColourFormatter f(indent);
+ out << fuc(
+ (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()),
+ fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()),
+ fv<'v'>(k.pretty_print_flat(f)),
+ fv<'i'>(std::string(indent, ' ')),
+ fv<'b'>(important ? "true" : "")
+ );
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter f(indent);
diff --git a/src/clients/cave/colour_formatter-fmt.hh b/src/clients/cave/colour_formatter-fmt.hh
index 1ecaf90eb..5877729e5 100644
--- a/src/clients/cave/colour_formatter-fmt.hh
+++ b/src/clients/cave/colour_formatter-fmt.hh
@@ -12,6 +12,9 @@ const auto fs_format_keyword_name_unaccepted = make_format_string_fetcher("forma
const auto fs_format_string_plain = make_format_string_fetcher("format-string/plain", 1)
<< param<'s'>();
+const auto fs_format_string_string_plain = make_format_string_fetcher("format-string-string/plain", 1)
+ << param<'k'>() << "=" << param<'v'>();
+
const auto fs_format_package_id_plain = make_format_string_fetcher("format-package-id/plain", 1)
<< param<'s'>();
diff --git a/src/clients/cave/colour_formatter.cc b/src/clients/cave/colour_formatter.cc
index 75992c5c2..ed0c14a3e 100644
--- a/src/clients/cave/colour_formatter.cc
+++ b/src/clients/cave/colour_formatter.cc
@@ -108,6 +108,12 @@ ColourFormatter::format(const std::string & s, const format::Plain &) const
}
std::string
+ColourFormatter::format(const std::pair<const std::string, std::string> & s, const format::Plain &) const
+{
+ return fuc(fs_format_string_string_plain(), fv<'k'>(stringify(s.first)), fv<'v'>(stringify(s.second)));
+}
+
+std::string
ColourFormatter::format(const PackageID & s, const format::Plain &) const
{
return fuc(fs_format_package_id_plain(), fv<'s'>(stringify(s)));
diff --git a/src/clients/cave/colour_formatter.hh b/src/clients/cave/colour_formatter.hh
index ef3037ca2..17b548aa8 100644
--- a/src/clients/cave/colour_formatter.hh
+++ b/src/clients/cave/colour_formatter.hh
@@ -31,6 +31,7 @@ namespace paludis
class PALUDIS_VISIBLE ColourFormatter :
public CanFormat<KeywordName>,
public CanFormat<std::string>,
+ public CanFormat<std::pair<const std::string, std::string> >,
public CanFormat<PackageID>,
public CanFormat<LicenseDepSpec>,
public CanFormat<ConditionalDepSpec>,
@@ -67,6 +68,8 @@ namespace paludis
std::string format(const std::string &, const format::Plain &) const;
+ std::string format(const std::pair<const std::string, std::string> &, const format::Plain &) const;
+
std::string format(const PackageID &, const format::Plain &) const;
std::string format(const PackageID &, const format::Installed &) const;
std::string format(const PackageID &, const format::Installable &) const;
diff --git a/src/clients/cave/format_plain_metadata_key.cc b/src/clients/cave/format_plain_metadata_key.cc
index 253c19ca5..e469f9328 100644
--- a/src/clients/cave/format_plain_metadata_key.cc
+++ b/src/clients/cave/format_plain_metadata_key.cc
@@ -153,6 +153,12 @@ namespace
s << k.pretty_print_flat(f);
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ StringifyFormatter f;
+ s << k.pretty_print_flat(f);
+ }
+
void visit(const MetadataCollectionKey<KeywordNameSet> & k)
{
StringifyFormatter f;
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index 36e273867..c85019363 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -181,6 +181,11 @@ namespace
}
};
+ std::string stringify_string_pair(const std::pair<const std::string, std::string> & s)
+ {
+ return s.first + "=" + s.second;
+ }
+
class KeyVisitor
{
private:
@@ -298,6 +303,17 @@ namespace
std::bind(&Matcher::operator(), std::cref(_m), _1));
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & s)
+ {
+ using namespace std::placeholders;
+
+ if (_flatten)
+ result = _m(join(s.value()->begin(), s.value()->end(), " ", stringify_string_pair));
+ else
+ result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
+ std::bind(&Matcher::operator(), std::cref(_m), std::bind(&stringify_string_pair, _1)));
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & s)
{
using namespace std::placeholders;
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index d0cda2737..0ac0b7f21 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -147,6 +147,11 @@ namespace
const std::shared_ptr<const Set<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ const std::shared_ptr<const Map<std::string, std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
const std::shared_ptr<const Sequence<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value());
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 8d962dc36..74e5b0385 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -160,6 +160,12 @@ namespace
std::cout << k.pretty_print_flat(f) << std::endl;
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
StringifyFormatter f;
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index 7d2679120..23bb93ca4 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -201,6 +201,12 @@ namespace
cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter f;
diff --git a/src/output/colour_formatter.cc b/src/output/colour_formatter.cc
index 6c36f3f7d..0f0aa3e9d 100644
--- a/src/output/colour_formatter.cc
+++ b/src/output/colour_formatter.cc
@@ -183,6 +183,12 @@ ColourFormatter::format(const std::string & f, const format::Plain &) const
}
std::string
+ColourFormatter::format(const std::pair<const std::string, std::string> & f, const format::Plain &) const
+{
+ return stringify(f.first) + "=" + stringify(f.second);
+}
+
+std::string
ColourFormatter::format(const PlainTextLabelDepSpec & f, const format::Plain &) const
{
return stringify(f);
diff --git a/src/output/colour_formatter.hh b/src/output/colour_formatter.hh
index 75c6fab09..5de2b6d82 100644
--- a/src/output/colour_formatter.hh
+++ b/src/output/colour_formatter.hh
@@ -42,6 +42,7 @@ class ColourFormatter :
public paludis::CanFormat<paludis::FSPath>,
public paludis::CanFormat<paludis::PackageID>,
public paludis::CanFormat<std::string>,
+ public paludis::CanFormat<std::pair<const std::string, std::string> >,
public paludis::CanSpace
{
public:
@@ -77,6 +78,8 @@ class ColourFormatter :
std::string format(const std::string &, const paludis::format::Plain &) const;
+ std::string format(const std::pair<const std::string, std::string> &, const paludis::format::Plain &) const;
+
std::string format(const paludis::PlainTextLabelDepSpec &, const paludis::format::Plain &) const;
std::string format(const paludis::URILabelsDepSpec &, const paludis::format::Plain &) const;
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 94bf3c578..3fee15652 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -365,6 +365,24 @@ namespace
}
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ if (k.type() == type)
+ {
+ ColourFormatter formatter;
+ if (task->want_raw())
+ {
+ task->output_left_column(k.raw_name() + ":", in);
+ task->output_right_column(k.pretty_print_flat(formatter));
+ }
+ else
+ {
+ task->output_left_column(k.human_name() + ":", in);
+ task->output_right_column(k.pretty_print_flat(formatter));
+ }
+ }
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
if (k.type() == type)
diff --git a/src/output/mask_displayer.cc b/src/output/mask_displayer.cc
index dd0fb1d37..3b7e9faa6 100644
--- a/src/output/mask_displayer.cc
+++ b/src/output/mask_displayer.cc
@@ -132,6 +132,12 @@ namespace
s << k.pretty_print_flat(formatter);
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ ColourFormatter formatter;
+ s << k.pretty_print_flat(formatter);
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter formatter;