aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-11-09 17:41:11 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-11-09 17:41:11 +0000
commit6837872ab88803893412e89cd2824189e634acc4 (patch)
treea2e7c21f03c6584db78ea37ddaac433f19b332e1
parent82ee0b8e135138b0ca7373afc9d57a002d6ec86a (diff)
downloadpaludis-6837872ab88803893412e89cd2824189e634acc4.tar.gz
paludis-6837872ab88803893412e89cd2824189e634acc4.tar.xz
Show map keys more elegantly
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc5
-rw-r--r--src/clients/cave/cmd_match.cc5
-rw-r--r--src/clients/cave/colour_formatter-fmt.hh4
-rw-r--r--src/clients/cave/colour_formatter.cc3
-rw-r--r--src/clients/inquisitio/key_extractor.cc5
5 files changed, 16 insertions, 6 deletions
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index f61d5f3..2f80339 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -34,7 +34,10 @@ namespace
std::string stringify_string_pair(const std::pair<const std::string, std::string> & s)
{
- return s.first + "=" + s.second;
+ if (s.first.empty())
+ return s.second;
+ else
+ return s.first + "=" + s.second;
}
/* We use this visitor to display extra information about a MetadataKey,
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index 220f150..077f6cc 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -148,7 +148,10 @@ namespace
std::string stringify_string_pair(const std::pair<const std::string, std::string> & s)
{
- return s.first + "=" + s.second;
+ if (s.first.empty())
+ return s.second;
+ else
+ return s.first + "=" + s.second;
}
struct SpecTreeAsString
diff --git a/src/clients/cave/colour_formatter-fmt.hh b/src/clients/cave/colour_formatter-fmt.hh
index 5877729..cb600cc 100644
--- a/src/clients/cave/colour_formatter-fmt.hh
+++ b/src/clients/cave/colour_formatter-fmt.hh
@@ -12,8 +12,8 @@ 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_string_string_plain = make_format_string_fetcher("format-string-string/plain", 2)
+ << param<'k'>() << param<'e'>() << 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 ed0c14a..4da25e1 100644
--- a/src/clients/cave/colour_formatter.cc
+++ b/src/clients/cave/colour_formatter.cc
@@ -110,7 +110,8 @@ 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)));
+ return fuc(fs_format_string_string_plain(), fv<'k'>(stringify(s.first)), fv<'v'>(stringify(s.second)),
+ fv<'e'>(s.first.empty() ? "" : "="));
}
std::string
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index c850193..04e56f1 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -183,7 +183,10 @@ namespace
std::string stringify_string_pair(const std::pair<const std::string, std::string> & s)
{
- return s.first + "=" + s.second;
+ if (s.first.empty())
+ return s.second;
+ else
+ return s.first + "=" + s.second;
}
class KeyVisitor