aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2009-12-19 16:11:55 +0100
committerAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2009-12-19 16:11:55 +0100
commitbc08fd50d067b83778777dca564c50aff04f411e (patch)
treec6adc9f02dd47bd678d2c0565e5335e8501c67d7
parenta3d96708eccd024489b7369c8d7f0b51699effab (diff)
downloadpaludis-bc08fd50d067b83778777dca564c50aff04f411e.tar.gz
paludis-bc08fd50d067b83778777dca564c50aff04f411e.tar.xz
cave show --type auto tries to show packages before repositories
Having 'cave show python' show the ::python repository is confusing.
-rw-r--r--src/clients/cave/cmd_show.cc32
-rw-r--r--src/clients/cave/exceptions.cc5
-rw-r--r--src/clients/cave/exceptions.hh1
3 files changed, 24 insertions, 14 deletions
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index f306fa3..913b543 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -911,32 +911,36 @@ ShowCommand::run(
{
try
{
- RepositoryName repo_name(*p);
- if (env->package_database()->has_repository_named(repo_name))
- {
- do_one_repository(cmdline, env, repo_name);
- continue;
- }
- }
- catch (const RepositoryNameError &)
- {
- }
-
- try
- {
PackageDepSpec spec(parse_user_package_dep_spec(*p, env.get(), UserPackageDepSpecOptions() +
updso_throw_if_set + updso_allow_wildcards));
if ((! spec.package_ptr()))
do_one_wildcard(env, spec);
else
do_one_package(cmdline, env, spec);
+ continue;
}
catch (const GotASetNotAPackageDepSpec &)
{
do_one_set(env, SetName(*p));
+ continue;
+ }
+ catch (const NoSuchPackageError &)
+ {
+ try
+ {
+ RepositoryName repo_name(*p);
+ if (env->package_database()->has_repository_named(repo_name))
+ {
+ do_one_repository(cmdline, env, repo_name);
+ continue;
+ }
+ }
+ catch (const RepositoryNameError &)
+ {
+ }
}
- continue;
+ throw NothingMatching(*p);
}
else
throw args::DoHelp("bad value '" + cmdline.a_type.argument() + "' for --" + cmdline.a_type.long_name());
diff --git a/src/clients/cave/exceptions.cc b/src/clients/cave/exceptions.cc
index 43a622d..755ef21 100644
--- a/src/clients/cave/exceptions.cc
+++ b/src/clients/cave/exceptions.cc
@@ -34,6 +34,11 @@ NothingMatching::NothingMatching(const PackageDepSpec & spec) throw () :
{
}
+NothingMatching::NothingMatching(const std::string & name) throw () :
+ Exception("Found nothing suitable matching '" + name + "'")
+{
+}
+
BeMoreSpecific::BeMoreSpecific(const PackageDepSpec & spec, const std::tr1::shared_ptr<const PackageIDSequence> & s) throw () :
Exception("Found multiple suitable IDs matching '" + stringify(spec) + "': { '" + join(indirect_iterator(s->begin()),
indirect_iterator(s->end()), "', '") + "' }")
diff --git a/src/clients/cave/exceptions.hh b/src/clients/cave/exceptions.hh
index b157b07..c5082c2 100644
--- a/src/clients/cave/exceptions.hh
+++ b/src/clients/cave/exceptions.hh
@@ -35,6 +35,7 @@ namespace paludis
{
public:
NothingMatching(const PackageDepSpec &) throw ();
+ NothingMatching(const std::string &) throw ();
};
class PALUDIS_VISIBLE BeMoreSpecific :