Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Return an error if opam info/list/search returns an empty result.

This is related to #469 and (vaguely) to #560
  • Loading branch information...
commit 6b8d0a34e08f77d60c01a720c695cfe7a7d08631 1 parent d4319f0
@samoht samoht authored
Showing with 15 additions and 9 deletions.
  1. +15 −9 src/client/opamClient.ml
View
24 src/client/opamClient.ml
@@ -299,15 +299,21 @@ let names_of_regexp t ~installed_only ~name_only ~case_sensitive ~all regexps =
) names OpamPackage.Name.Map.empty in
(* Filter the list of packages, depending on user predicates *)
- OpamPackage.Name.Map.filter (fun name { installed_version; synopsis; descr } ->
- (not installed_only || installed_version <> None) (* installp *)
- && (regexps = [] (* allp *)
- || name_only && exact_match (OpamPackage.Name.to_string name) (* namep *)
- || not name_only (* descrp *)
- && (partial_match (OpamPackage.Name.to_string name)
- || partial_match synopsis
- || partial_match descr))
- ) names
+ let names =
+ OpamPackage.Name.Map.filter (fun name { installed_version; synopsis; descr } ->
+ (not installed_only || installed_version <> None) (* installp *)
+ && (regexps = [] (* allp *)
+ || name_only && exact_match (OpamPackage.Name.to_string name) (* namep *)
+ || not name_only (* descrp *)
+ && (partial_match (OpamPackage.Name.to_string name)
+ || partial_match synopsis
+ || partial_match descr))
+ ) names in
+
+ if OpamPackage.Name.Map.is_empty names then
+ OpamGlobals.error_and_exit "No packages found."
+ else
+ names
module API = struct
Please sign in to comment.
Something went wrong with that request. Please try again.