aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-05-18 23:02:37 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-05-18 23:02:57 +0100
commit56a34d9c0c93f4c93eeb29abf60c1b0141df3f6a (patch)
tree013947c8d257d9818a11f50ab7652f3c95abfe35
parent588ac44cf734545aa9a02ee53a8624ee878de50d (diff)
downloadpaludis-56a34d9c0c93f4c93eeb29abf60c1b0141df3f6a.tar.gz
paludis-56a34d9c0c93f4c93eeb29abf60c1b0141df3f6a.tar.xz
Show if in system, world
-rw-r--r--src/clients/cave/cmd_show-fmt.hh6
-rw-r--r--src/clients/cave/cmd_show.cc16
2 files changed, 19 insertions, 3 deletions
diff --git a/src/clients/cave/cmd_show-fmt.hh b/src/clients/cave/cmd_show-fmt.hh
index 69aa6b2..59c90e5 100644
--- a/src/clients/cave/cmd_show-fmt.hh
+++ b/src/clients/cave/cmd_show-fmt.hh
@@ -114,8 +114,10 @@ const auto fs_metadata_subsection_raw = make_format_string_fetcher("show/metadat
<< " " << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>()
<< c::bold_blue_or_pink() << param<'s'>() << c::normal() << "\\n";
-const auto fs_package_id_heading = make_format_string_fetcher("show/package_id_heading", 1)
- << " " << c::bold_blue_or_pink() << param<'s'>() << c::normal() << "\\n";
+const auto fs_package_id_heading = make_format_string_fetcher("show/package_id_heading", 2)
+ << " " << c::bold_blue_or_pink() << param<'s'>() << c::normal()
+ << param_if<'t'>() << c::yellow() << " (" << param<'t'>() << ")" << c::normal() << param_endif<'t'>()
+ << "\\n";
const auto fs_package_id_masks = make_format_string_fetcher("show/package_id_masks", 1)
<< " " << c::bold_red() << param<'s'>() << c::normal() << "\\n";
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index eef9f82..2f4ce6b 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -57,6 +57,7 @@
#include <paludis/contents.hh>
#include <paludis/dep_spec_data.hh>
#include <paludis/dep_spec_annotations.hh>
+#include <paludis/match_package.hh>
#include <cstdlib>
#include <iostream>
@@ -1145,7 +1146,20 @@ namespace
const bool old_id_is_installed,
std::ostream & out)
{
- out << fuc(fs_package_id_heading(), fv<'s'>(stringify(*best)));
+ std::string in_sets;
+ {
+ auto system(env->set(SetName("system")));
+ if (system && match_package_in_set(*env, *system, best, { }))
+ in_sets = "system";
+ else
+ {
+ auto world(env->set(SetName("world")));
+ if (world && match_package_in_set(*env, *world, best, { }))
+ in_sets = "world";
+ }
+ }
+
+ out << fuc(fs_package_id_heading(), fv<'s'>(stringify(*best)), fv<'t'>(in_sets));
std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys(best->begin_metadata(), best->end_metadata());
for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator
k(keys.begin()), k_end(keys.end()) ; k != k_end ; ++k)