package open

  1. Overview
  2. Docs
Conveniently open files such as PDFs in their default applications.

Install

Dune Dependency

Authors

Maintainers

Sources

v0.2.1.tar.gz
md5=06ff5e4158525c187ba9049757d5d942

Description

Published: 18 Apr 2018

README

ocaml-open

Conveniently open files such as PDFs in their default applications straigt from OCaml.

Quick start

You can install the library using opam:

$ opam install open

Then in utop or ocaml,

$ ocaml
> #require "open";;
> Open.in_default_app "/home/steffen/ocaml.svg";;
- : bool = true

The boolean returned by Open.in_default_app indicates whether the open command exited normally:

> Open.in_default_app "/path/to/non-existent.file";;
- : bool = false

API

The tiny API is documented here.

Building from source

Dependencies

The library requires dune (formerly known as jbuilder) to build, but has no other dependencies.

Building Library and Examples

Run make to build and make test to see the library in action. This should open several files from the examples/basic folder.

There is also a more sophisticated example in examples/graphviz that requires graphivz and Jane Street's core (version v0.9.0 or higher). You can build & run it as follows:

jbuilder build @graphviz

Limitations and Implementation

The library has been tested under Linux, MacOS, and Cygwin. There is experimental support for native Windows, but this is untested. The implementation uses

  • xdg-open on Linux

  • open on MacOS

  • cygstart on Cygiwn, and

  • cmd start on Windows.

Suggestion and Contributions

Suggestions and contributions are always welcome. Feel free to submit pull requests.

Dependencies (2)

  1. jbuilder >= "1.0+beta7"
  2. ocaml >= "4.02.3"

Dev Dependencies

None

Used by (3)

  1. frenetic >= "5.0.5"
  2. idds
  3. netkat

Conflicts

None