aboutsummaryrefslogtreecommitdiff
path: root/src/clients/cave
diff options
context:
space:
mode:
Diffstat (limited to 'src/clients/cave')
-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
8 files changed, 52 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;