aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2007-11-23 17:09:17 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2007-11-23 17:09:17 +0000
commit4ee1f83fe481e25028be7f11e2c54cdeff0f6a8f (patch)
tree9855a800d305efee8715513360b50fbf5ead1433
parentce1ca8fc3a3963309e1002ee2072888d9d57badc (diff)
downloadpaludis-4ee1f83fe481e25028be7f11e2c54cdeff0f6a8f.tar.gz
paludis-4ee1f83fe481e25028be7f11e2c54cdeff0f6a8f.tar.xz
Add --no-suggestions option, and use it automatically when stdout is not a tty.
-rw-r--r--src/clients/adjutrix/adjutrix.cc3
-rw-r--r--src/clients/adjutrix/command_line.cc1
-rw-r--r--src/clients/adjutrix/command_line.hh1
-rw-r--r--src/clients/adjutrix/find_reverse_deps.cc24
-rw-r--r--src/clients/adjutrix/what_needs_keywording.cc24
-rw-r--r--src/clients/contrarius/install.cc5
-rw-r--r--src/clients/importare/importare.cc154
-rw-r--r--src/clients/importare/install.cc5
-rw-r--r--src/clients/paludis/command_line.cc1
-rw-r--r--src/clients/paludis/command_line.hh3
-rw-r--r--src/clients/paludis/do_contents.cc24
-rw-r--r--src/clients/paludis/install.cc5
-rw-r--r--src/clients/paludis/paludis.cc27
-rw-r--r--src/clients/paludis/query.cc24
-rw-r--r--src/clients/paludis/uninstall.cc24
-rw-r--r--src/clients/reconcilio/install.cc5
-rw-r--r--src/output/console_install_task.cc75
-rw-r--r--src/output/console_install_task.hh1
18 files changed, 232 insertions, 174 deletions
diff --git a/src/clients/adjutrix/adjutrix.cc b/src/clients/adjutrix/adjutrix.cc
index 3009114..42c9e18 100644
--- a/src/clients/adjutrix/adjutrix.cc
+++ b/src/clients/adjutrix/adjutrix.cc
@@ -35,6 +35,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
#include <iostream>
+#include <unistd.h>
using namespace paludis;
using std::cout;
@@ -94,6 +95,8 @@ main(int argc, char *argv[])
{
CommandLine::get_instance()->run(argc, argv, "adjutrix", "ADJUTRIX_OPTIONS", "ADJUTRIX_CMDLINE");
set_use_colour(! CommandLine::get_instance()->a_no_color.specified());
+ if (1 != isatty(1))
+ CommandLine::get_instance()->a_no_suggestions.set_specified(true);
if (CommandLine::get_instance()->a_help.specified())
throw DoHelp();
diff --git a/src/clients/adjutrix/command_line.cc b/src/clients/adjutrix/command_line.cc
index b7f78ec..c4131ef 100644
--- a/src/clients/adjutrix/command_line.cc
+++ b/src/clients/adjutrix/command_line.cc
@@ -77,6 +77,7 @@ CommandLine::CommandLine() :
a_log_level(&general_args, "log-level", '\0'),
a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false),
a_no_color(&a_no_colour, "no-color"),
+ a_no_suggestions(&general_args, "no-suggestions", '\0', "Do not give suggestions if an unknown name is specified", false),
a_repository_directory(&general_args, "repository-dir", 'D',
"Where to find the repository (default: detected from ./ or ../ or ../..)"),
diff --git a/src/clients/adjutrix/command_line.hh b/src/clients/adjutrix/command_line.hh
index 470900a..83a0339 100644
--- a/src/clients/adjutrix/command_line.hh
+++ b/src/clients/adjutrix/command_line.hh
@@ -88,6 +88,7 @@ class CommandLine :
paludis::args::LogLevelArg a_log_level;
paludis::args::SwitchArg a_no_colour;
paludis::args::AliasArg a_no_color;
+ paludis::args::SwitchArg a_no_suggestions;
paludis::args::StringArg a_repository_directory;
diff --git a/src/clients/adjutrix/find_reverse_deps.cc b/src/clients/adjutrix/find_reverse_deps.cc
index 5a39ee9..afa0589 100644
--- a/src/clients/adjutrix/find_reverse_deps.cc
+++ b/src/clients/adjutrix/find_reverse_deps.cc
@@ -284,18 +284,24 @@ int do_find_reverse_deps(NoConfigEnvironment & env)
cout << endl;
cerr << "Query error:" << endl;
cerr << " * " << e.backtrace("\n * ");
- cerr << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
+ cerr << "Could not find '" << e.name() << "'.";
- FuzzyCandidatesFinder f(env, e.name(), query::All());
+ if (! CommandLine::get_instance()->a_no_suggestions.specified())
+ {
+ cerr << " Looking for suggestions:" << endl;
- if (f.begin() == f.end())
- cerr << "No suggestions found." << endl;
- else
- cerr << "Suggestions:" << endl;
+ FuzzyCandidatesFinder f(env, e.name(), query::All());
+
+ if (f.begin() == f.end())
+ cerr << "No suggestions found." << endl;
+ else
+ cerr << "Suggestions:" << endl;
+
+ for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
+ c_end(f.end()) ; c != c_end ; ++c)
+ cerr << " * " << colour(cl_package_name, *c) << endl;
+ }
- for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
- c_end(f.end()) ; c != c_end ; ++c)
- cerr << " * " << colour(cl_package_name, *c) << endl;
cerr << endl;
return 5;
}
diff --git a/src/clients/adjutrix/what_needs_keywording.cc b/src/clients/adjutrix/what_needs_keywording.cc
index 62e4c3f..e00f00a 100644
--- a/src/clients/adjutrix/what_needs_keywording.cc
+++ b/src/clients/adjutrix/what_needs_keywording.cc
@@ -100,18 +100,24 @@ int do_what_needs_keywording(NoConfigEnvironment & env)
cout << endl;
cerr << "Query error:" << endl;
cerr << " * " << e.backtrace("\n * ");
- cerr << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
+ cerr << "Could not find '" << e.name() << "'.";
- FuzzyCandidatesFinder f(env, e.name(), query::All());
+ if (! CommandLine::get_instance()->a_no_suggestions.specified())
+ {
+ cerr << " Looking for suggestions:" << endl;
- if (f.begin() == f.end())
- cerr << "No suggestions found." << endl;
- else
- cerr << "Suggestions:" << endl;
+ FuzzyCandidatesFinder f(env, e.name(), query::All());
+
+ if (f.begin() == f.end())
+ cerr << "No suggestions found." << endl;
+ else
+ cerr << "Suggestions:" << endl;
+
+ for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
+ c_end(f.end()) ; c != c_end ; ++c)
+ cerr << " * " << colour(cl_package_name, *c) << endl;
+ }
- for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
- c_end(f.end()) ; c != c_end ; ++c)
- cerr << " * " << colour(cl_package_name, *c) << endl;
cerr << endl;
return 5;
}
diff --git a/src/clients/contrarius/install.cc b/src/clients/contrarius/install.cc
index 96f2ccd..7a8de65 100644
--- a/src/clients/contrarius/install.cc
+++ b/src/clients/contrarius/install.cc
@@ -101,6 +101,11 @@ namespace
return false;
}
+ virtual bool want_suggestions() const
+ {
+ return false;
+ }
+
virtual std::string make_resume_command(const PackageIDSequence &) const
{
return "";
diff --git a/src/clients/importare/importare.cc b/src/clients/importare/importare.cc
index 28767ba..81d878d 100644
--- a/src/clients/importare/importare.cc
+++ b/src/clients/importare/importare.cc
@@ -30,7 +30,6 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/about.hh>
#include <paludis/repository_maker.hh>
-#include <paludis/fuzzy_finder.hh>
#include <paludis/query.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
@@ -112,104 +111,79 @@ main(int argc, char *argv[])
tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(env_spec));
env->set_paludis_command(paludis_command);
- try
- {
- std::vector<std::string> params(
- CommandLine::get_instance()->begin_parameters(),
- CommandLine::get_instance()->end_parameters());
+ std::vector<std::string> params(
+ CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters());
- if ((params.size() > 3) || (params.size() < 1))
- throw args::DoHelp("install action takes between one and three parameters (cat/pkg version slot)");
+ if ((params.size() > 3) || (params.size() < 1))
+ throw args::DoHelp("install action takes between one and three parameters (cat/pkg version slot)");
- QualifiedPackageName q(params[0]);
- VersionSpec v(params.size() >= 2 ? params[1] : "0");
- SlotName s(params.size() >= 3 ? params[2] : "0");
+ QualifiedPackageName q(params[0]);
+ VersionSpec v(params.size() >= 2 ? params[1] : "0");
+ SlotName s(params.size() >= 3 ? params[2] : "0");
- std::string build_dependencies, run_dependencies, description;
+ std::string build_dependencies, run_dependencies, description;
- if (CommandLine::get_instance()->a_preserve_metadata.specified())
+ if (CommandLine::get_instance()->a_preserve_metadata.specified())
+ {
+ tr1::shared_ptr<const PackageIDSequence> old_ids(
+ env->package_database()->query(query::Package(q), qo_order_by_version));
+ tr1::shared_ptr<const PackageID> old_id;
+ for (PackageIDSequence::ConstIterator i(old_ids->begin()), i_end(old_ids->end()) ;
+ i != i_end ; ++i)
{
- tr1::shared_ptr<const PackageIDSequence> old_ids(
- env->package_database()->query(query::Package(q), qo_order_by_version));
- tr1::shared_ptr<const PackageID> old_id;
- for (PackageIDSequence::ConstIterator i(old_ids->begin()), i_end(old_ids->end()) ;
- i != i_end ; ++i)
- {
- if (! (*i)->repository()->format_key())
- continue;
- if ((*i)->repository()->format_key()->value() != "installed_unpackaged")
- continue;
- old_id = *i;
- break;
- }
-
- if (! old_id)
- throw args::DoHelp("--" + CommandLine::get_instance()->a_preserve_metadata.long_name() + " specified but "
- "no old ID available");
-
- StringifyFormatter f;
- if (old_id->short_description_key())
- description = old_id->short_description_key()->value();
- if (old_id->build_dependencies_key())
- build_dependencies = old_id->build_dependencies_key()->pretty_print_flat(f);
- if (old_id->run_dependencies_key())
- run_dependencies = old_id->run_dependencies_key()->pretty_print_flat(f);
+ if (! (*i)->repository()->format_key())
+ continue;
+ if ((*i)->repository()->format_key()->value() != "installed_unpackaged")
+ continue;
+ old_id = *i;
+ break;
}
- if (CommandLine::get_instance()->a_description.specified())
- description = CommandLine::get_instance()->a_description.argument();
- if (CommandLine::get_instance()->a_build_dependency.specified())
- build_dependencies = join(
- CommandLine::get_instance()->a_build_dependency.begin_args(),
- CommandLine::get_instance()->a_build_dependency.end_args(), ", ");
- if (CommandLine::get_instance()->a_run_dependency.specified())
- run_dependencies = join(
- CommandLine::get_instance()->a_run_dependency.begin_args(),
- CommandLine::get_instance()->a_run_dependency.end_args(), ", ");
-
- tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
- keys->insert("location", stringify(
- CommandLine::get_instance()->a_location.specified() ?
- FSEntry(CommandLine::get_instance()->a_location.argument()) :
- FSEntry::cwd()));
- keys->insert("format", "unpackaged");
- keys->insert("name", stringify(q));
- keys->insert("version", stringify(v));
- keys->insert("slot", stringify(s));
- keys->insert("description", description);
- keys->insert("build_dependencies", build_dependencies);
- keys->insert("run_dependencies", run_dependencies);
- tr1::shared_ptr<Repository> repo((*RepositoryMaker::get_instance()->find_maker("unpackaged"))(env.get(), keys));
- env->package_database()->add_repository(10, repo);
- tr1::shared_ptr<const PackageIDSequence> ids(repo->package_ids(q));
- if (1 != std::distance(ids->begin(), ids->end()))
- throw InternalError(PALUDIS_HERE, "ids is '" + join(indirect_iterator(ids->begin()), indirect_iterator(
- ids->end()), " ") + "'");
-
- return do_install(env, *ids->begin());
+ if (! old_id)
+ throw args::DoHelp("--" + CommandLine::get_instance()->a_preserve_metadata.long_name() + " specified but "
+ "no old ID available");
+
+ StringifyFormatter f;
+ if (old_id->short_description_key())
+ description = old_id->short_description_key()->value();
+ if (old_id->build_dependencies_key())
+ build_dependencies = old_id->build_dependencies_key()->pretty_print_flat(f);
+ if (old_id->run_dependencies_key())
+ run_dependencies = old_id->run_dependencies_key()->pretty_print_flat(f);
}
- catch (const NoSuchRepositoryError & e)
- {
- cout << endl;
- cerr << "Unhandled exception:" << endl
- << " * " << e.backtrace("\n * ")
- << e.message() << " (" << e.what() << ")" << endl;
- cerr << " * Looking for suggestions:" << endl;
-
- FuzzyRepositoriesFinder f(*env, stringify(e.name()));
- if (f.begin() == f.end())
- cerr << "No suggestions found." << endl;
- else
- cerr << "Suggestions:" << endl;
-
- for (FuzzyRepositoriesFinder::RepositoriesConstIterator r(f.begin()), r_end(f.end()) ;
- r != r_end ; ++r)
- cerr << " * " << colour(cl_repository_name, *r) << endl;
- cerr << endl;
-
- return EXIT_FAILURE;
- }
+ if (CommandLine::get_instance()->a_description.specified())
+ description = CommandLine::get_instance()->a_description.argument();
+ if (CommandLine::get_instance()->a_build_dependency.specified())
+ build_dependencies = join(
+ CommandLine::get_instance()->a_build_dependency.begin_args(),
+ CommandLine::get_instance()->a_build_dependency.end_args(), ", ");
+ if (CommandLine::get_instance()->a_run_dependency.specified())
+ run_dependencies = join(
+ CommandLine::get_instance()->a_run_dependency.begin_args(),
+ CommandLine::get_instance()->a_run_dependency.end_args(), ", ");
+
+ tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("location", stringify(
+ CommandLine::get_instance()->a_location.specified() ?
+ FSEntry(CommandLine::get_instance()->a_location.argument()) :
+ FSEntry::cwd()));
+ keys->insert("format", "unpackaged");
+ keys->insert("name", stringify(q));
+ keys->insert("version", stringify(v));
+ keys->insert("slot", stringify(s));
+ keys->insert("description", description);
+ keys->insert("build_dependencies", build_dependencies);
+ keys->insert("run_dependencies", run_dependencies);
+ tr1::shared_ptr<Repository> repo((*RepositoryMaker::get_instance()->find_maker("unpackaged"))(env.get(), keys));
+ env->package_database()->add_repository(10, repo);
+ tr1::shared_ptr<const PackageIDSequence> ids(repo->package_ids(q));
+ if (1 != std::distance(ids->begin(), ids->end()))
+ throw InternalError(PALUDIS_HERE, "ids is '" + join(indirect_iterator(ids->begin()), indirect_iterator(
+ ids->end()), " ") + "'");
+
+ return do_install(env, *ids->begin());
}
catch (const DoVersion &)
{
diff --git a/src/clients/importare/install.cc b/src/clients/importare/install.cc
index 1759d42..19e2205 100644
--- a/src/clients/importare/install.cc
+++ b/src/clients/importare/install.cc
@@ -103,6 +103,11 @@ namespace
return CommandLine::get_instance()->a_compact.specified();
}
+ virtual bool want_suggestions() const
+ {
+ return false;
+ }
+
virtual bool want_new_descriptions() const
{
return CommandLine::get_instance()->install_args.want_new_descriptions();
diff --git a/src/clients/paludis/command_line.cc b/src/clients/paludis/command_line.cc
index 68dbd7d..56a5571 100644
--- a/src/clients/paludis/command_line.cc
+++ b/src/clients/paludis/command_line.cc
@@ -70,6 +70,7 @@ CommandLine::CommandLine() :
a_log_level(&general_args, "log-level", '\0'),
a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false),
a_no_color(&a_no_colour, "no-color"),
+ a_no_suggestions(&general_args, "no-suggestions", '\0', "Do not give suggestions if an unknown name is specified", false),
a_environment(&general_args, "environment", 'E', "Environment specification (class:suffix, both parts optional)"),
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"),
diff --git a/src/clients/paludis/command_line.hh b/src/clients/paludis/command_line.hh
index e56dec2..89487aa 100644
--- a/src/clients/paludis/command_line.hh
+++ b/src/clients/paludis/command_line.hh
@@ -160,6 +160,9 @@ class CommandLine :
/// --no-color
paludis::args::AliasArg a_no_color;
+ /// --no-suggestions
+ paludis::args::SwitchArg a_no_suggestions;
+
/// --environment
paludis::args::StringArg a_environment;
diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc
index b948845..e8e7350 100644
--- a/src/clients/paludis/do_contents.cc
+++ b/src/clients/paludis/do_contents.cc
@@ -153,18 +153,24 @@ do_contents(tr1::shared_ptr<Environment> env)
cout << endl;
cerr << "Query error:" << endl;
cerr << " * " << e.backtrace("\n * ");
- cerr << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
+ cerr << "Could not find '" << e.name() << "'.";
- FuzzyCandidatesFinder f(*env, e.name(), query::InstalledAtRoot(env->root()));
+ if (! CommandLine::get_instance()->a_no_suggestions.specified())
+ {
+ cerr << " Looking for suggestions:" << endl;
- if (f.begin() == f.end())
- cerr << "No suggestions found." << endl;
- else
- cerr << "Suggestions:" << endl;
+ FuzzyCandidatesFinder f(*env, e.name(), query::InstalledAtRoot(env->root()));
+
+ if (f.begin() == f.end())
+ cerr << "No suggestions found." << endl;
+ else
+ cerr << "Suggestions:" << endl;
+
+ for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
+ c_end(f.end()) ; c != c_end ; ++c)
+ cerr << " * " << colour(cl_package_name, *c) << endl;
+ }
- for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
- c_end(f.end()) ; c != c_end ; ++c)
- cerr << " * " << colour(cl_package_name, *c) << endl;
cerr << endl;
}
catch (const PackageDatabaseLookupError & e)
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 02a2f60..cba8adc 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -106,6 +106,11 @@ namespace
return CommandLine::get_instance()->a_compact.specified();
}
+ virtual bool want_suggestions() const
+ {
+ return ! CommandLine::get_instance()->a_no_suggestions.specified();
+ }
+
virtual bool want_new_descriptions() const
{
return CommandLine::get_instance()->install_args.want_new_descriptions();
diff --git a/src/clients/paludis/paludis.cc b/src/clients/paludis/paludis.cc
index 7d49209..af53044 100644
--- a/src/clients/paludis/paludis.cc
+++ b/src/clients/paludis/paludis.cc
@@ -49,6 +49,7 @@
#include <iterator>
#include <time.h>
+#include <unistd.h>
/** \file
* Main paludis program.
@@ -93,6 +94,8 @@ main(int argc, char *argv[])
{
CommandLine::get_instance()->run(argc, argv, "paludis", "PALUDIS_OPTIONS", "PALUDIS_CMDLINE");
set_use_colour(! CommandLine::get_instance()->a_no_color.specified());
+ if (1 != isatty(1))
+ CommandLine::get_instance()->a_no_suggestions.set_specified(true);
if (CommandLine::get_instance()->a_help.specified())
throw args::DoHelp();
@@ -473,19 +476,23 @@ main(int argc, char *argv[])
cerr << "Unhandled exception:" << endl
<< " * " << e.backtrace("\n * ")
<< e.message() << " (" << e.what() << ")" << endl;
- cerr << " * Looking for suggestions:" << endl;
- FuzzyRepositoriesFinder f(*env, stringify(e.name()));
+ if (! CommandLine::get_instance()->a_no_suggestions.specified())
+ {
+ cerr << " * Looking for suggestions:" << endl;
- if (f.begin() == f.end())
- cerr << "No suggestions found." << endl;
- else
- cerr << "Suggestions:" << endl;
+ FuzzyRepositoriesFinder f(*env, stringify(e.name()));
- for (FuzzyRepositoriesFinder::RepositoriesConstIterator r(f.begin()), r_end(f.end()) ;
- r != r_end ; ++r)
- cerr << " * " << colour(cl_repository_name, *r) << endl;
- cerr << endl;
+ if (f.begin() == f.end())
+ cerr << "No suggestions found." << endl;
+ else
+ cerr << "Suggestions:" << endl;
+
+ for (FuzzyRepositoriesFinder::RepositoriesConstIterator r(f.begin()), r_end(f.end()) ;
+ r != r_end ; ++r)
+ cerr << " * " << colour(cl_repository_name, *r) << endl;
+ cerr << endl;
+ }
return EXIT_FAILURE;
}
diff --git a/src/clients/paludis/query.cc b/src/clients/paludis/query.cc
index a0ac5c4..5f59b7d 100644
--- a/src/clients/paludis/query.cc
+++ b/src/clients/paludis/query.cc
@@ -189,18 +189,24 @@ int do_query(tr1::shared_ptr<Environment> env)
cout << endl;
cerr << "Query error:" << endl;
cerr << " * " << e.backtrace("\n * ");
- cerr << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
+ cerr << "Could not find '" << e.name() << "'.";
- FuzzyCandidatesFinder f(*env, e.name(), query::All());
+ if (! CommandLine::get_instance()->a_no_suggestions.specified())
+ {
+ cerr << " Looking for suggestions:" << endl;
+
+ FuzzyCandidatesFinder f(*env, e.name(), query::All());
- if (f.begin() == f.end())
- cerr << "No suggestions found." << endl;
- else
- cerr << "Suggestions:" << endl;
+ if (f.begin() == f.end())
+ cerr << "No suggestions found." << endl;
+ else
+ cerr << "Suggestions:" << endl;
+
+ for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
+ c_end(f.end()) ; c != c_end ; ++c)
+ cerr << " * " << colour(cl_package_name, *c) << endl;
+ }
- for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
- c_end(f.end()) ; c != c_end ; ++c)
- cerr << " * " << colour(cl_package_name, *c) << endl;
cerr << endl;
}
catch (const PackageDatabaseLookupError & e)
diff --git a/src/clients/paludis/uninstall.cc b/src/clients/paludis/uninstall.cc
index e1d5b28..851440e 100644
--- a/src/clients/paludis/uninstall.cc
+++ b/src/clients/paludis/uninstall.cc
@@ -294,18 +294,24 @@ namespace
cout << endl;
cerr << "Query error:" << endl;
cerr << " * " << e.backtrace("\n * ");
- cerr << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
+ cerr << "Could not find '" << e.name() << "'.";
- FuzzyCandidatesFinder f(*env, e.name(), query::InstalledAtRoot(env->root()));
+ if (! CommandLine::get_instance()->a_no_suggestions.specified())
+ {
+ cerr << " Looking for suggestions:" << endl;
- if (f.begin() == f.end())
- cerr << "No suggestions found." << endl;
- else
- cerr << "Suggestions:" << endl;
+ FuzzyCandidatesFinder f(*env, e.name(), query::InstalledAtRoot(env->root()));
+
+ if (f.begin() == f.end())
+ cerr << "No suggestions found." << endl;
+ else
+ cerr << "Suggestions:" << endl;
+
+ for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
+ c_end(f.end()) ; c != c_end ; ++c)
+ cerr << " * " << colour(cl_package_name, *c) << endl;
+ }
- for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
- c_end(f.end()) ; c != c_end ; ++c)
- cerr << " * " << colour(cl_package_name, *c) << endl;
cerr << endl;
}
diff --git a/src/clients/reconcilio/install.cc b/src/clients/reconcilio/install.cc
index 19daa1d..95bbd3c 100644
--- a/src/clients/reconcilio/install.cc
+++ b/src/clients/reconcilio/install.cc
@@ -87,6 +87,11 @@ namespace
return CommandLine::get_instance()->a_compact.specified();
}
+ virtual bool want_suggestions() const
+ {
+ return false;
+ }
+
virtual bool want_new_descriptions() const
{
return CommandLine::get_instance()->install_args.want_new_descriptions();
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 6d14b3d..bd19fcf 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -179,18 +179,24 @@ ConsoleInstallTask::try_to_add_target(const std::string & s)
output_stream() << endl;
output_stream() << "Query error:" << endl;
output_stream() << " * " << e.backtrace("\n * ");
- output_stream() << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
+ output_stream() << "Could not find '" << e.name() << "'.";
- FuzzyCandidatesFinder f(*environment(), e.name(), query::SupportsAction<InstallAction>() & query::NotMasked());
+ if (want_suggestions())
+ {
+ output_stream() << " Looking for suggestions:" << endl;
- if (f.begin() == f.end())
- output_stream() << "No suggestions found." << endl;
- else
- output_stream() << "Suggestions:" << endl;
+ FuzzyCandidatesFinder f(*environment(), e.name(), query::SupportsAction<InstallAction>() & query::NotMasked());
+
+ if (f.begin() == f.end())
+ output_stream() << "No suggestions found." << endl;
+ else
+ output_stream() << "Suggestions:" << endl;
+
+ for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
+ c_end(f.end()) ; c != c_end ; ++c)
+ output_stream() << " * " << colour(cl_package_name, *c) << endl;
+ }
- for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
- c_end(f.end()) ; c != c_end ; ++c)
- output_stream() << " * " << colour(cl_package_name, *c) << endl;
output_stream() << endl;
is_ok = false;;
}
@@ -1450,19 +1456,25 @@ ConsoleInstallTask::on_no_such_package_error(const NoSuchPackageError & e)
output_stream() << endl;
output_stream() << "Query error:" << endl;
output_stream() << " * " << e.backtrace("\n * ");
- output_stream() << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
+ output_stream() << "Could not find '" << e.name() << "'.";
- FuzzyCandidatesFinder f(*environment(), e.name(),
- query::SupportsAction<InstallAction>() & query::NotMasked());
+ if (want_suggestions())
+ {
+ output_stream() << " Looking for suggestions:" << endl;
- if (f.begin() == f.end())
- output_stream() << "No suggestions found." << endl;
- else
- output_stream() << "Suggestions:" << endl;
+ FuzzyCandidatesFinder f(*environment(), e.name(),
+ query::SupportsAction<InstallAction>() & query::NotMasked());
+
+ if (f.begin() == f.end())
+ output_stream() << "No suggestions found." << endl;
+ else
+ output_stream() << "Suggestions:" << endl;
+
+ for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()), c_end(f.end())
+ ; c != c_end ; ++c)
+ output_stream() << " * " << colour(cl_package_name, *c) << endl;
+ }
- for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()), c_end(f.end())
- ; c != c_end ; ++c)
- output_stream() << " * " << colour(cl_package_name, *c) << endl;
output_stream() << endl;
}
@@ -1479,19 +1491,24 @@ ConsoleInstallTask::on_all_masked_error(const AllMaskedError & e)
output_stream() << endl;
output_stream() << "Query error:" << endl;
output_stream() << " * " << e.backtrace("\n * ");
- output_stream() << "No versions of '" << e.query() << "' are available. Looking for suggestions:" << endl;
+ output_stream() << "No versions of '" << e.query() << "' are available.";
+
+ if (want_suggestions())
+ {
+ output_stream() << " Looking for suggestions:" << endl;
- FuzzyCandidatesFinder f(*environment(), stringify(e.query()),
- query::SupportsAction<InstallAction>() & query::NotMasked());
+ FuzzyCandidatesFinder f(*environment(), stringify(e.query()),
+ query::SupportsAction<InstallAction>() & query::NotMasked());
- if (f.begin() == f.end())
- output_stream() << "No suggestions found." << endl;
- else
- output_stream() << "Suggestions:" << endl;
+ if (f.begin() == f.end())
+ output_stream() << "No suggestions found." << endl;
+ else
+ output_stream() << "Suggestions:" << endl;
- for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()), c_end(f.end())
- ; c != c_end ; ++c)
- output_stream() << " * " << colour(cl_package_name, *c) << endl;
+ for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()), c_end(f.end())
+ ; c != c_end ; ++c)
+ output_stream() << " * " << colour(cl_package_name, *c) << endl;
+ }
}
else
{
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index cb21c12..f18ed86 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -297,6 +297,7 @@ namespace paludis
virtual bool want_existing_descriptions() const = 0;
virtual bool want_compact() const = 0;
+ virtual bool want_suggestions() const = 0;
///\}