aboutsummaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-08 17:20:24 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-08 17:20:24 +0000
commit2bd8fc4a7c8c53ad828c7fe25010719392c13328 (patch)
treed4ec1232cc2072284436b90cec462f0194916bab /src/output
parent9a12a516009982fb3e95ec0f7d21ae53556a99ff (diff)
downloadpaludis-2bd8fc4a7c8c53ad828c7fe25010719392c13328.tar.gz
paludis-2bd8fc4a7c8c53ad828c7fe25010719392c13328.tar.xz
--compact for paludis --query / inquisitio
Diffstat (limited to 'src/output')
-rw-r--r--src/output/console_query_task.cc37
-rw-r--r--src/output/console_query_task.hh3
2 files changed, 35 insertions, 5 deletions
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index ca82bd9de..2e60fb562 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -89,11 +89,18 @@ ConsoleQueryTask::show(const PackageDepSpec & a, tr1::shared_ptr<const PackageID
display_entry = *i;
}
- display_header(a, display_entry);
- display_versions_by_repository(a, entries, display_entry);
- display_metadata(a, display_entry);
- display_masks(a, display_entry);
- output_endl();
+ if (want_compact())
+ {
+ display_compact(a, display_entry);
+ }
+ else
+ {
+ display_header(a, display_entry);
+ display_versions_by_repository(a, entries, display_entry);
+ display_metadata(a, display_entry);
+ display_masks(a, display_entry);
+ output_endl();
+ }
}
void
@@ -107,6 +114,26 @@ ConsoleQueryTask::display_header(const PackageDepSpec & a, const tr1::shared_ptr
}
void
+ConsoleQueryTask::display_compact(const PackageDepSpec & a, const tr1::shared_ptr<const PackageID> & e) const
+{
+ if (a.version_requirements_ptr() || a.slot_ptr() || a.use_requirements_ptr() ||
+ a.repository_ptr())
+ {
+ std::string pad(std::max<long>(1, 30 - stringify(a).length()), ' ');
+ output_starred_item_no_endl(render_as_package_name(stringify(a)) + pad);
+ }
+ else
+ {
+ std::string pad(std::max<long>(1, 30 - stringify(e->name()).length()), ' ');
+ output_starred_item_no_endl(render_as_package_name(stringify(e->name())) + pad);
+ }
+
+ if (e->short_description_key())
+ output_no_endl(e->short_description_key()->value());
+ output_endl();
+}
+
+void
ConsoleQueryTask::display_versions_by_repository(const PackageDepSpec &,
tr1::shared_ptr<const PackageIDSequence> entries,
const tr1::shared_ptr<const PackageID> & display_entry) const
diff --git a/src/output/console_query_task.hh b/src/output/console_query_task.hh
index 921e14de9..ccd1992a6 100644
--- a/src/output/console_query_task.hh
+++ b/src/output/console_query_task.hh
@@ -55,6 +55,9 @@ namespace paludis
virtual void display_masks(const PackageDepSpec &, const tr1::shared_ptr<const PackageID> &) const;
+ virtual void display_compact(const PackageDepSpec &, const tr1::shared_ptr<const PackageID> &) const;
+
+ virtual bool want_compact() const = 0;
virtual bool want_deps() const = 0;
virtual bool want_raw() const = 0;