aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-26 22:29:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-26 22:29:30 +0000
commitd68d20bb34c57bbe1b13ee260dee0e567aad983d (patch)
treee7e4281f419f3a52e8e5a33f5b6e838559ed6de7
parent567ab602aa21d69e2f8966b939b59902b5bae826 (diff)
downloadpaludis-d68d20bb34c57bbe1b13ee260dee0e567aad983d.tar.gz
paludis-d68d20bb34c57bbe1b13ee260dee0e567aad983d.tar.xz
Allow adjutrix -r pkgname
-rw-r--r--src/adjutrix/find_reverse_deps.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/adjutrix/find_reverse_deps.cc b/src/adjutrix/find_reverse_deps.cc
index cd35452..3b1b92f 100644
--- a/src/adjutrix/find_reverse_deps.cc
+++ b/src/adjutrix/find_reverse_deps.cc
@@ -19,6 +19,7 @@
#include "find_reverse_deps.hh"
#include "command_line.hh"
+#include "colour.hh"
#include <paludis/util/compare.hh>
#include <paludis/util/collection_concrete.hh>
@@ -216,7 +217,30 @@ int do_find_reverse_deps(AdjutrixEnvironment & env)
env.set_profile(env.main_repository_dir() / "profiles" / "default-linux" / "amd64" / "2006.1");
- PackageDepAtom::Pointer atom(new PackageDepAtom(*CommandLine::get_instance()->begin_parameters()));
+ PackageDepAtom::Pointer atom(0);
+ try
+ {
+ if (std::string::npos == CommandLine::get_instance()->begin_parameters()->find('/'))
+ {
+ atom.assign(new PackageDepAtom(env.package_database()->fetch_unique_qualified_package_name(
+ PackageNamePart(*CommandLine::get_instance()->begin_parameters()))));
+ }
+ else
+ atom.assign(new PackageDepAtom(*CommandLine::get_instance()->begin_parameters()));
+ }
+ catch (const AmbiguousPackageNameError & e)
+ {
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << "Ambiguous package name '" << e.name() << "'. Did you mean:" << endl;
+ for (AmbiguousPackageNameError::OptionsIterator o(e.begin_options()),
+ o_end(e.end_options()) ; o != o_end ; ++o)
+ cerr << " * " << colour(cl_package_name, *o) << endl;
+ cerr << endl;
+ return 4;
+ }
+
PackageDatabaseEntryCollection::Pointer entries(env.package_database()->query(atom, is_either));
int ret(0);