aboutsummaryrefslogtreecommitdiff
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
parent9a12a516009982fb3e95ec0f7d21ae53556a99ff (diff)
downloadpaludis-2bd8fc4a7c8c53ad828c7fe25010719392c13328.tar.gz
paludis-2bd8fc4a7c8c53ad828c7fe25010719392c13328.tar.xz
--compact for paludis --query / inquisitio
-rw-r--r--NEWS2
-rw-r--r--paludis/args/install_args_group.cc7
-rw-r--r--paludis/args/install_args_group.hh4
-rw-r--r--src/clients/importare/command_line.cc1
-rw-r--r--src/clients/importare/command_line.hh1
-rw-r--r--src/clients/importare/install.cc2
-rw-r--r--src/clients/inquisitio/command_line.cc2
-rw-r--r--src/clients/inquisitio/command_line.hh2
-rw-r--r--src/clients/inquisitio/query_task.cc6
-rw-r--r--src/clients/inquisitio/query_task.hh1
-rw-r--r--src/clients/paludis/command_line.cc1
-rw-r--r--src/clients/paludis/command_line.hh3
-rw-r--r--src/clients/paludis/install.cc2
-rw-r--r--src/clients/paludis/query.cc6
-rw-r--r--src/clients/reconcilio/command_line.cc1
-rw-r--r--src/clients/reconcilio/command_line.hh1
-rw-r--r--src/clients/reconcilio/install.cc2
-rw-r--r--src/output/console_query_task.cc37
-rw-r--r--src/output/console_query_task.hh3
19 files changed, 61 insertions, 23 deletions
diff --git a/NEWS b/NEWS
index 10b6efe..b8fe26f 100644
--- a/NEWS
+++ b/NEWS
@@ -8,7 +8,7 @@ trunk/:
* STILL BROKEN, wait for 0.26.0 if you use these: CRAN, Ruby bindings for
dep specs.
- * inquisitio --all-versions, --not.
+ * inquisitio --all-versions, --not, --compact.
* paludis, reconcilio, importare --compact, --show-package-descriptions.
diff --git a/paludis/args/install_args_group.cc b/paludis/args/install_args_group.cc
index 21bfd08..4f97b92 100644
--- a/paludis/args/install_args_group.cc
+++ b/paludis/args/install_args_group.cc
@@ -59,7 +59,6 @@ InstallArgsGroup::InstallArgsGroup(ArgsHandler * h, const std::string & our_name
("new", "Show descriptions for new packages")
("all", "Show descriptions for all packages"),
"none"),
- a_compact(this, "compact", '\0', "Display output using one line per entry"),
a_continue_on_failure(this, "continue-on-failure", '\0', "Whether to continue after a fetch or install error",
args::EnumArg::EnumArgOptions
("if-fetch-only", "If fetching only")
@@ -195,12 +194,6 @@ InstallArgsGroup::want_existing_descriptions() const
return "all" == a_show_package_descriptions.argument();
}
-bool
-InstallArgsGroup::want_compact() const
-{
- return a_compact.specified();
-}
-
std::string
InstallArgsGroup::paludis_command_fragment() const
{
diff --git a/paludis/args/install_args_group.hh b/paludis/args/install_args_group.hh
index 236aead..1221154 100644
--- a/paludis/args/install_args_group.hh
+++ b/paludis/args/install_args_group.hh
@@ -98,9 +98,6 @@ namespace paludis
/// --show-package-descriptions
paludis::args::EnumArg a_show_package_descriptions;
- /// --compact
- paludis::args::SwitchArg a_compact;
-
/// --continue-on-failure
paludis::args::EnumArg a_continue_on_failure;
@@ -133,7 +130,6 @@ namespace paludis
bool want_changed_use_flags() const;
bool want_new_use_flags() const;
- bool want_compact() const;
bool want_new_descriptions() const;
bool want_existing_descriptions() const;
diff --git a/src/clients/importare/command_line.cc b/src/clients/importare/command_line.cc
index 8fb09c0..abddbe5 100644
--- a/src/clients/importare/command_line.cc
+++ b/src/clients/importare/command_line.cc
@@ -40,6 +40,7 @@ CommandLine::CommandLine() :
a_no_colour(&general_args, "no-colour", '\0', "Do not use colour"),
a_no_color(&a_no_colour, "no-color"),
a_environment(&general_args, "environment", 'E', "Environment specification (class:suffix, both parts optional)"),
+ a_compact(&general_args, "compact", '\0', "Display output using one line per entry"),
source_args(this, "Source options",
"Options affecting the source image"),
diff --git a/src/clients/importare/command_line.hh b/src/clients/importare/command_line.hh
index 4f73266..d66371c 100644
--- a/src/clients/importare/command_line.hh
+++ b/src/clients/importare/command_line.hh
@@ -51,6 +51,7 @@ class CommandLine :
paludis::args::SwitchArg a_no_colour;
paludis::args::AliasArg a_no_color;
paludis::args::StringArg a_environment;
+ paludis::args::SwitchArg a_compact;
paludis::args::ArgsGroup source_args;
paludis::args::StringArg a_location;
diff --git a/src/clients/importare/install.cc b/src/clients/importare/install.cc
index 9eb0850..1759d42 100644
--- a/src/clients/importare/install.cc
+++ b/src/clients/importare/install.cc
@@ -100,7 +100,7 @@ namespace
virtual bool want_compact() const
{
- return CommandLine::get_instance()->install_args.want_compact();
+ return CommandLine::get_instance()->a_compact.specified();
}
virtual bool want_new_descriptions() const
diff --git a/src/clients/inquisitio/command_line.cc b/src/clients/inquisitio/command_line.cc
index d9addd1..5a3cd29 100644
--- a/src/clients/inquisitio/command_line.cc
+++ b/src/clients/inquisitio/command_line.cc
@@ -77,7 +77,7 @@ CommandLine::CommandLine() :
output_args(this, "Output options",
"Options that control how output is generated."),
- a_list(&output_args, "list", 'l', "Output a package name list only"),
+ a_compact(&output_args, "compact", '\0', "Display output using one line per entry"),
a_show_dependencies(&output_args, "show-dependencies", 'D', "Show dependencies"),
a_show_metadata(&output_args, "show-metadata", 'M', "Show raw metadata"),
diff --git a/src/clients/inquisitio/command_line.hh b/src/clients/inquisitio/command_line.hh
index 66be686..a1eddcd 100644
--- a/src/clients/inquisitio/command_line.hh
+++ b/src/clients/inquisitio/command_line.hh
@@ -96,7 +96,7 @@ class CommandLine :
///\{
paludis::args::ArgsGroup output_args;
- paludis::args::SwitchArg a_list;
+ paludis::args::SwitchArg a_compact;
paludis::args::SwitchArg a_show_dependencies;
paludis::args::SwitchArg a_show_metadata;
diff --git a/src/clients/inquisitio/query_task.cc b/src/clients/inquisitio/query_task.cc
index 345b1f0..52acf94 100644
--- a/src/clients/inquisitio/query_task.cc
+++ b/src/clients/inquisitio/query_task.cc
@@ -40,3 +40,9 @@ InquisitioQueryTask::want_raw() const
return CommandLine::get_instance()->a_show_metadata.specified();
}
+bool
+InquisitioQueryTask::want_compact() const
+{
+ return CommandLine::get_instance()->a_compact.specified();
+}
+
diff --git a/src/clients/inquisitio/query_task.hh b/src/clients/inquisitio/query_task.hh
index 1a98e84..b335ec9 100644
--- a/src/clients/inquisitio/query_task.hh
+++ b/src/clients/inquisitio/query_task.hh
@@ -30,6 +30,7 @@ namespace inquisitio
public:
InquisitioQueryTask(const paludis::Environment * const);
+ virtual bool want_compact() const;
virtual bool want_deps() const;
virtual bool want_raw() const;
};
diff --git a/src/clients/paludis/command_line.cc b/src/clients/paludis/command_line.cc
index dd23f99..e17c007 100644
--- a/src/clients/paludis/command_line.cc
+++ b/src/clients/paludis/command_line.cc
@@ -79,6 +79,7 @@ CommandLine::CommandLine() :
a_parallel(&general_args, "parallel", 'P', "Does nothing. (For compatibility with Paludis when built with thread "
"support, which you shouldn't be using.)"),
#endif
+ a_compact(&general_args, "compact", '\0', "Display output using one line per entry (--install, --query)"),
query_args(this, "Query options",
"Options which are relevant for --query."),
diff --git a/src/clients/paludis/command_line.hh b/src/clients/paludis/command_line.hh
index 40918cd..6b8b4bb 100644
--- a/src/clients/paludis/command_line.hh
+++ b/src/clients/paludis/command_line.hh
@@ -169,6 +169,9 @@ class CommandLine :
/// --parallel
paludis::args::SwitchArg a_parallel;
+ /// --compact
+ paludis::args::SwitchArg a_compact;
+
///}
/// \name Query arguments
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 6034013..02a2f60 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -103,7 +103,7 @@ namespace
virtual bool want_compact() const
{
- return CommandLine::get_instance()->install_args.want_compact();
+ return CommandLine::get_instance()->a_compact.specified();
}
virtual bool want_new_descriptions() const
diff --git a/src/clients/paludis/query.cc b/src/clients/paludis/query.cc
index 874d1e9..d9087f2 100644
--- a/src/clients/paludis/query.cc
+++ b/src/clients/paludis/query.cc
@@ -57,6 +57,11 @@ namespace
{
return CommandLine::get_instance()->a_show_metadata.specified();
}
+
+ bool want_compact() const
+ {
+ return CommandLine::get_instance()->a_compact.specified();
+ }
};
}
@@ -69,7 +74,6 @@ void do_one_package_query(
query.show(*spec);
std::copy(query.masks_to_explain()->begin(), query.masks_to_explain()->end(),
masks_to_explain->inserter());
- cout << endl;
}
namespace
diff --git a/src/clients/reconcilio/command_line.cc b/src/clients/reconcilio/command_line.cc
index ce3bdf8..748b27d 100644
--- a/src/clients/reconcilio/command_line.cc
+++ b/src/clients/reconcilio/command_line.cc
@@ -45,6 +45,7 @@ CommandLine::CommandLine() :
a_verbose(&general_args, "verbose", 'v', "Display more detailed output"),
a_resume_command_template(&general_args, "resume-command-template", '\0',
"Save the resume command to a file. If the filename contains 'XXXXXX', use mkstemp(3) to generate the filename"),
+ a_compact(&general_args, "compact", '\0', "Display output using one line per entry"),
fix_linkage_args(this, "Fix Linkage options",
"Options which are relevant for --fix-linkage."),
diff --git a/src/clients/reconcilio/command_line.hh b/src/clients/reconcilio/command_line.hh
index 001f853..6406f02 100644
--- a/src/clients/reconcilio/command_line.hh
+++ b/src/clients/reconcilio/command_line.hh
@@ -55,6 +55,7 @@ class CommandLine :
paludis::args::SwitchArg a_exact;
paludis::args::SwitchArg a_verbose;
paludis::args::StringArg a_resume_command_template;
+ paludis::args::SwitchArg a_compact;
paludis::args::ArgsGroup fix_linkage_args;
paludis::args::StringArg a_library;
diff --git a/src/clients/reconcilio/install.cc b/src/clients/reconcilio/install.cc
index b396606..19daa1d 100644
--- a/src/clients/reconcilio/install.cc
+++ b/src/clients/reconcilio/install.cc
@@ -84,7 +84,7 @@ namespace
virtual bool want_compact() const
{
- return CommandLine::get_instance()->install_args.want_compact();
+ return CommandLine::get_instance()->a_compact.specified();
}
virtual bool want_new_descriptions() const
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index ca82bd9..2e60fb5 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 921e14d..ccd1992 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;