aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-24 16:41:38 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-24 16:41:38 +0000
commitc438d03ce1fd9e40ad13787c3dbb346e7b8eed42 (patch)
tree559685e9bca0134525febe39d7fc2743697637bd
parentc1e7676ecf2018847646b1e34c2198e099fb8fcf (diff)
downloadpaludis-c438d03ce1fd9e40ad13787c3dbb346e7b8eed42.tar.gz
paludis-c438d03ce1fd9e40ad13787c3dbb346e7b8eed42.tar.xz
Split up use flag descriptions by expand prefix
-rw-r--r--src/console_install_task.cc57
-rw-r--r--src/console_install_task.hh8
-rw-r--r--src/use_flag_pretty_printer.cc11
-rw-r--r--src/use_flag_pretty_printer.hh2
4 files changed, 62 insertions, 16 deletions
diff --git a/src/console_install_task.cc b/src/console_install_task.cc
index 1d5bc7c..d3906fe 100644
--- a/src/console_install_task.cc
+++ b/src/console_install_task.cc
@@ -25,6 +25,7 @@
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/compare.hh>
#include <paludis/util/sr.hh>
+#include <paludis/util/strip.hh>
#include <algorithm>
#include <set>
@@ -39,7 +40,8 @@ ConsoleInstallTask::ConsoleInstallTask(Environment * const env,
const DepListOptions & options) :
InstallTask(env, options),
_all_tags(new SortedCollection<DepTagEntry>::Concrete),
- _all_use_descriptions(new SortedCollection<UseDescription>::Concrete)
+ _all_use_descriptions(new SortedCollection<UseDescription>::Concrete),
+ _all_expand_prefixes(new UseFlagNameCollection::Concrete)
{
std::fill_n(_counts, static_cast<int>(last_count), 0);
}
@@ -120,7 +122,11 @@ ConsoleInstallTask::on_display_merge_list_post()
output_endl();
display_merge_list_post_counts();
display_merge_list_post_tags();
- display_merge_list_post_use_descriptions();
+
+ display_merge_list_post_use_descriptions("");
+ for (UseFlagNameCollection::Iterator f(_all_expand_prefixes->begin()),
+ f_end(_all_expand_prefixes->end()) ; f != f_end ; ++f)
+ display_merge_list_post_use_descriptions(stringify(*f));
}
void
@@ -346,7 +352,7 @@ ConsoleInstallTask::display_merge_list_post_tags()
}
void
-ConsoleInstallTask::display_merge_list_post_use_descriptions()
+ConsoleInstallTask::display_merge_list_post_use_descriptions(const std::string & prefix)
{
if (! want_use_summary())
return;
@@ -376,16 +382,33 @@ ConsoleInstallTask::display_merge_list_post_use_descriptions()
break;
}
+ if (prefix.empty())
+ {
+ bool prefixed(false);
+ for (UseFlagNameCollection::Iterator f(_all_expand_prefixes->begin()),
+ f_end(_all_expand_prefixes->end()) ; f != f_end && ! prefixed ; ++f)
+ if (0 == stringify(i->flag).compare(0, stringify(*f).length(), stringify(*f)))
+ prefixed = true;
+
+ if (prefixed)
+ continue;
+ }
+ else
+ {
+ if (0 != stringify(i->flag).compare(0, prefix.length(), prefix))
+ continue;
+ }
+
if (! started)
{
- display_use_summary_start();
+ display_use_summary_start(prefix);
started = true;
}
if (old_flag != i->flag)
{
if (! group->empty())
- display_use_summary_flag(group->begin(), group->end());
+ display_use_summary_flag(prefix, group->begin(), group->end());
old_flag = i->flag;
group.assign(new SortedCollection<UseDescription>::Concrete);
}
@@ -394,26 +417,31 @@ ConsoleInstallTask::display_merge_list_post_use_descriptions()
}
if (! group->empty())
- display_use_summary_flag(group->begin(), group->end());
+ display_use_summary_flag(prefix, group->begin(), group->end());
if (started)
display_use_summary_end();
}
void
-ConsoleInstallTask::display_use_summary_start()
+ConsoleInstallTask::display_use_summary_start(const std::string & prefix)
{
- output_heading("Use flags:");
+ if (! prefix.empty())
+ output_heading(prefix + ":");
+ else
+ output_heading("Use flags:");
}
void
-ConsoleInstallTask::display_use_summary_flag(SortedCollection<UseDescription>::Iterator i,
+ConsoleInstallTask::display_use_summary_flag(const std::string & prefix,
+ SortedCollection<UseDescription>::Iterator i,
SortedCollection<UseDescription>::Iterator i_end)
{
if (next(i) == i_end)
{
std::ostringstream s;
- s << std::left << std::setw(30) << (render_as_tag(stringify(i->flag)) + ": ");
+ s << std::left << std::setw(30) << (render_as_tag(
+ strip_leading_string(stringify(i->flag), prefix + "_")) + ": ");
s << i->description;
output_starred_item(s.str());
}
@@ -427,13 +455,16 @@ ConsoleInstallTask::display_use_summary_flag(SortedCollection<UseDescription>::I
if (all_same)
{
std::ostringstream s;
- s << std::left << std::setw(30) << (render_as_tag(stringify(i->flag)) + ": ");
+ s << std::left << std::setw(30) << (render_as_tag(
+ strip_leading_string(stringify(i->flag), prefix + "_")) + ": ");
s << i->description;
output_starred_item(s.str());
}
else
{
- output_starred_item(render_as_tag(stringify(i->flag)) + ":");
+ output_starred_item(render_as_tag(
+ strip_leading_string(stringify(i->flag), prefix + "_")) + ":");
+
for ( ; i != i_end ; ++i)
{
std::ostringstream s;
@@ -639,6 +670,8 @@ ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
_add_descriptions(printer->new_flags(), d.package, uds_new);
_add_descriptions(printer->changed_flags(), d.package, uds_changed);
_add_descriptions(printer->unchanged_flags(), d.package, uds_unchanged);
+ _all_expand_prefixes->insert(printer->expand_prefixes()->begin(),
+ printer->expand_prefixes()->end());
}
void
diff --git a/src/console_install_task.hh b/src/console_install_task.hh
index 8ce3ff1..bc0d4c9 100644
--- a/src/console_install_task.hh
+++ b/src/console_install_task.hh
@@ -100,6 +100,7 @@ namespace paludis
int _counts[last_count];
SortedCollection<DepTagEntry>::Pointer _all_tags;
SortedCollection<UseDescription>::Pointer _all_use_descriptions;
+ UseFlagNameCollection::Pointer _all_expand_prefixes;
void _add_descriptions(UseFlagNameCollection::ConstPointer,
const PackageDatabaseEntry &, UseDescriptionState);
@@ -208,9 +209,10 @@ namespace paludis
virtual void display_tag_summary_tag_post_text(const DepTagCategory &);
virtual void display_tag_summary_end();
- virtual void display_merge_list_post_use_descriptions();
- virtual void display_use_summary_start();
- virtual void display_use_summary_flag(SortedCollection<UseDescription>::Iterator,
+ virtual void display_merge_list_post_use_descriptions(const std::string &);
+ virtual void display_use_summary_start(const std::string &);
+ virtual void display_use_summary_flag(const std::string &,
+ SortedCollection<UseDescription>::Iterator,
SortedCollection<UseDescription>::Iterator);
virtual void display_use_summary_end();
diff --git a/src/use_flag_pretty_printer.cc b/src/use_flag_pretty_printer.cc
index afb5df3..eef2082 100644
--- a/src/use_flag_pretty_printer.cc
+++ b/src/use_flag_pretty_printer.cc
@@ -33,7 +33,8 @@ UseFlagPrettyPrinter::UseFlagPrettyPrinter(const Environment * const e) :
_need_space(false),
_new_flags(new UseFlagNameCollection::Concrete),
_changed_flags(new UseFlagNameCollection::Concrete),
- _unchanged_flags(new UseFlagNameCollection::Concrete)
+ _unchanged_flags(new UseFlagNameCollection::Concrete),
+ _expand_prefixes(new UseFlagNameCollection::Concrete)
{
}
@@ -141,6 +142,8 @@ UseFlagPrettyPrinter::print_package_flags(const PackageDatabaseEntry & pkg,
UseFlagName expand_name(flag->data().substr(0, delim_pos)),
expand_value(flag->data().substr(delim_pos + 1));
+ _expand_prefixes->insert(expand_name);
+
if (expand_name != old_expand_name)
{
output_expand_prefix(stringify(expand_name));
@@ -279,3 +282,9 @@ UseFlagPrettyPrinter::unchanged_flags() const
return _unchanged_flags;
}
+UseFlagNameCollection::ConstPointer
+UseFlagPrettyPrinter::expand_prefixes() const
+{
+ return _expand_prefixes;
+}
+
diff --git a/src/use_flag_pretty_printer.hh b/src/use_flag_pretty_printer.hh
index ab6472a..6fcfb18 100644
--- a/src/use_flag_pretty_printer.hh
+++ b/src/use_flag_pretty_printer.hh
@@ -39,6 +39,7 @@ namespace paludis
UseFlagNameCollection::Pointer _new_flags;
UseFlagNameCollection::Pointer _changed_flags;
UseFlagNameCollection::Pointer _unchanged_flags;
+ UseFlagNameCollection::Pointer _expand_prefixes;
protected:
std::string::size_type use_expand_delim_pos(const UseFlagName & u,
@@ -69,6 +70,7 @@ namespace paludis
UseFlagNameCollection::ConstPointer new_flags() const;
UseFlagNameCollection::ConstPointer changed_flags() const;
UseFlagNameCollection::ConstPointer unchanged_flags() const;
+ UseFlagNameCollection::ConstPointer expand_prefixes() const;
};
}