package ocamline

  1. Overview
  2. Docs
Command line interface for user input

Install

Dune Dependency

Authors

Maintainers

Sources

1.1.tar.gz
md5=08fbed1f2f53acfbb2cdf08e8e876d44
sha512=045a9d427cafda3560d5af955c6e5866e5999185c9940adc0566a87a217ef922ebd24d5088749a179b3b282023907df6085feda063bd918c37fe88f1cb50dbfe

Description

Published: 19 Jan 2020

README

ocamline

This library provides a simple interface for reading user input in OCaml programs. The goal of this project is to reduce the burden of reading user input for programming language REPLs.

The feature that makes this library particularly useful is its handling of brackets. Any brackets that are opened must be closed before input is accepted.

Example

Source Code:
read ~brackets:['(',')'] ~prompt:"prompt>" ""
Command Line:
prompt> (lambda
          (x)
          (+ x 1))
prompt>

API

val read :  ?trim_delim:bool ->
            ?brackets:(char * char) list ->
            ?prompt:string ->
            ?strings:char list ->
            delim:string ->
            string
Parameter Description
trim_delim Whether or not to remove the line delimiter from the return value.
brackets Any characters that once opened must be closed before the line is accepted
prompt Customizes the prompt displayed to the user.
strings String delimiters. If brackets are in strings, they won't have to be closed.
delim The string that, when found, halts scanning and returns the input.

Contributions

Contributions to ocamline are greatly appreciated! ❤️

Please try to keep its implementation unassuming and configurable. 🙂

Dependencies (2)

  1. dune >= "1.9"
  2. ocaml

Dev Dependencies (1)

  1. alcotest with-test

Used by (2)

  1. gobba < "0.4.2"
  2. minicaml >= "0.4"

Conflicts

None