aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-11 16:52:02 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-11 16:52:26 +0000
commit93ad577d737b265a4fb921337ea7765a6dd2a27c (patch)
treed5cfe7dede24b332314277a097e44ec7e70b9a87
parente7738562740e3ec68c96e8e86a582f4da000aefd (diff)
downloadpaludis-93ad577d737b265a4fb921337ea7765a6dd2a27c.tar.gz
paludis-93ad577d737b265a4fb921337ea7765a6dd2a27c.tar.xz
Better error for uninstall multiple versions
-rw-r--r--src/clients/cave/cmd_uninstall.cc2
-rw-r--r--src/clients/cave/exceptions.cc7
-rw-r--r--src/clients/cave/exceptions.hh2
3 files changed, 10 insertions, 1 deletions
diff --git a/src/clients/cave/cmd_uninstall.cc b/src/clients/cave/cmd_uninstall.cc
index 78a0003..d7829fc 100644
--- a/src/clients/cave/cmd_uninstall.cc
+++ b/src/clients/cave/cmd_uninstall.cc
@@ -146,7 +146,7 @@ UninstallCommand::run(
if (ids->empty())
nothing_matching_error(env.get(), *p, filter::SupportsAction<UninstallAction>());
else if ((! cmdline.a_all_versions.specified()) && has_multiple_versions(ids))
- throw BeMoreSpecific(spec, ids);
+ throw BeMoreSpecific(spec, ids, "Consider using '--" + cmdline.a_all_versions.long_name() + "'");
else
{
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
diff --git a/src/clients/cave/exceptions.cc b/src/clients/cave/exceptions.cc
index c207b2e..b606320 100644
--- a/src/clients/cave/exceptions.cc
+++ b/src/clients/cave/exceptions.cc
@@ -57,6 +57,13 @@ BeMoreSpecific::BeMoreSpecific(const PackageDepSpec & spec, const std::shared_pt
{
}
+BeMoreSpecific::BeMoreSpecific(const PackageDepSpec & spec, const std::shared_ptr<const PackageIDSequence> & s,
+ const std::string & extra_message) throw () :
+ Exception("Found multiple suitable IDs matching '" + stringify(spec) + "': { '" + join(indirect_iterator(s->begin()),
+ indirect_iterator(s->end()), "', '") + "' }. " + extra_message)
+{
+}
+
BadIDForCommand::BadIDForCommand(const PackageDepSpec & spec, const std::shared_ptr<const PackageID> & s,
const std::string & r) throw () :
Exception("Spec '" + stringify(spec) + "' resolves to ID '" + stringify(*s) + "', which " + r)
diff --git a/src/clients/cave/exceptions.hh b/src/clients/cave/exceptions.hh
index 7e42f39..233c393 100644
--- a/src/clients/cave/exceptions.hh
+++ b/src/clients/cave/exceptions.hh
@@ -53,6 +53,8 @@ namespace paludis
{
public:
BeMoreSpecific(const PackageDepSpec &, const std::shared_ptr<const PackageIDSequence> &) throw ();
+ BeMoreSpecific(const PackageDepSpec &, const std::shared_ptr<const PackageIDSequence> &,
+ const std::string & extra_message) throw ();
};
class PALUDIS_VISIBLE BadIDForCommand :