aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-12 19:36:16 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-12 19:36:16 +0100
commitbc9513ea121b5f4f7486495b020e2acde57e5133 (patch)
tree88468cf445d665191054b2b5895fc15bfe2d6e99
parent0518d395ee9139edcf9061d1497d98cc6431473f (diff)
downloadpaludis-bc9513ea121b5f4f7486495b020e2acde57e5133.tar.gz
paludis-bc9513ea121b5f4f7486495b020e2acde57e5133.tar.xz
Show annotations in sets
-rw-r--r--src/clients/cave/cmd_show-fmt.hh15
-rw-r--r--src/clients/cave/cmd_show.cc13
-rw-r--r--src/clients/cave/select_format_for_spec.cc9
3 files changed, 30 insertions, 7 deletions
diff --git a/src/clients/cave/cmd_show-fmt.hh b/src/clients/cave/cmd_show-fmt.hh
index 075ddb4..69aa6b2 100644
--- a/src/clients/cave/cmd_show-fmt.hh
+++ b/src/clients/cave/cmd_show-fmt.hh
@@ -21,14 +21,17 @@ const auto fs_set_heading = make_format_string_fetcher("show/set_heading", 1)
const auto fs_set_set = make_format_string_fetcher("show/set_set", 1)
<< param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::blue_or_pink() << param<'s'>() << c::normal() << "\\n";
-const auto fs_set_spec_installed = make_format_string_fetcher("show/set_spec_installed", 1)
- << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::bold_green_or_pink() << param<'s'>() << c::normal() << "\\n";
+const auto fs_set_spec_installed = make_format_string_fetcher("show/set_spec_installed", 2)
+ << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::bold_green_or_pink() << param<'s'>() << c::normal()
+ << param_if<'a'>() << " [[ " << param<'a'>() << "]]" << param_endif<'a'>() << "\\n";
-const auto fs_set_spec_installable = make_format_string_fetcher("show/set_spec_installable", 1)
- << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::green_or_pink() << param<'s'>() << c::normal() << "\\n";
+const auto fs_set_spec_installable = make_format_string_fetcher("show/set_spec_installable", 2)
+ << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::green_or_pink() << param<'s'>() << c::normal()
+ << param_if<'a'>() << " [[ " << param<'a'>() << "]]" << param_endif<'a'>() << "\\n";
-const auto fs_set_spec_unavailable = make_format_string_fetcher("show/set_spec_unavailable", 1)
- << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::bold_red() << param<'s'>() << c::normal() << "\\n";
+const auto fs_set_spec_unavailable = make_format_string_fetcher("show/set_spec_unavailable", 2)
+ << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::bold_red() << param<'s'>() << c::normal()
+ << param_if<'a'>() << " [[ " << param<'a'>() << "]]" << param_endif<'a'>() << "\\n";
const auto fs_contents_file = make_format_string_fetcher("show/contents_file", 1)
<< param_if<'b'>() << "%{column 30}" << param_endif<'b'>() << param<'r'>() << param_if<'b'>() << "\\n" << param_else<'b'>() << " " << param_endif<'b'>();
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index a5c9804..eef9f82 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -56,6 +56,7 @@
#include <paludis/permitted_choice_value_parameter_values.hh>
#include <paludis/contents.hh>
#include <paludis/dep_spec_data.hh>
+#include <paludis/dep_spec_annotations.hh>
#include <cstdlib>
#include <iostream>
@@ -185,12 +186,22 @@ namespace
void visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node)
{
+ std::stringstream annotations;
+
+ if (node.spec()->maybe_annotations())
+ {
+ for (auto m(node.spec()->maybe_annotations()->begin()), m_end(node.spec()->maybe_annotations()->end()) ;
+ m != m_end ; ++m)
+ annotations << m->key() << " = [" << (m->value().empty() ? " " : " " + m->value() + " ") << "] ";
+ }
+
out << fuc(select_format_for_spec(env, *node.spec(), make_null_shared_ptr(),
fs_set_spec_installed(),
fs_set_spec_installable(),
fs_set_spec_unavailable()),
fv<'s'>(stringify(*node.spec())),
- fv<'i'>(std::string(indent, ' ')));
+ fv<'i'>(std::string(indent, ' ')),
+ fv<'a'>(annotations.str()));
}
void visit(const SetSpecTree::NodeType<NamedSetDepSpec>::Type & node)
diff --git a/src/clients/cave/select_format_for_spec.cc b/src/clients/cave/select_format_for_spec.cc
index 7ce380a..b9ba442 100644
--- a/src/clients/cave/select_format_for_spec.cc
+++ b/src/clients/cave/select_format_for_spec.cc
@@ -67,6 +67,15 @@ template FormatString<'i', 's'> paludis::cave::select_format_for_spec(
const FormatString<'i', 's'> & if_unavailable
);
+template FormatString<'a', 'i', 's'> paludis::cave::select_format_for_spec(
+ const std::shared_ptr<const Environment> & env,
+ const PackageDepSpec & spec,
+ const std::shared_ptr<const PackageID> & from_id,
+ const FormatString<'a', 'i', 's'> & if_installed,
+ const FormatString<'a', 'i', 's'> & if_installable,
+ const FormatString<'a', 'i', 's'> & if_unavailable
+ );
+
template FormatString<'s'> paludis::cave::select_format_for_spec(
const std::shared_ptr<const Environment> & env,
const PackageDepSpec & spec,