Skip to content

Commit

Permalink
Use printing from ocp-index.lib
Browse files Browse the repository at this point in the history
This will make the output equivalent to running
`ocp-index print List.find`. The type is included in the output.

Fixes #11.
  • Loading branch information
reynir committed Sep 7, 2017
1 parent 2a867c6 commit 738e4eb
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ocpIndexTop.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,13 @@ let resolve_all : (Longident.t -> string option) list -> Longident.t -> string =
let mk_directive resolver =
Toploop.Directive_ident (fun lident ->
let s = resolver lident in
match Lazy.force (LibIndex.get index s).LibIndex.doc with
| Some doc ->
print_endline doc
| None ->
Printf.printf "No documentation found for %s\n" s
| exception Not_found ->
try
LibIndex.get index s
|> LibIndex.Print.info
|> print_endline
with Not_found ->
print_endline "Unknown element.")


let () =
Hashtbl.add
Toploop.directive_table
Expand Down

0 comments on commit 738e4eb

Please sign in to comment.