package ocamline

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

Install

Dune Dependency

Authors

Maintainers

Sources

1.0.tar.gz
md5=5a9f82de288be5501f4f5023edaaad8c
sha512=88a8bdee3b55ba4bb99b7ea583f8d764e2c00c1b394093449714b0ebe840a453209d5b616e8e7773cd7c86405523bae364b8c9a9650814b4941005820b6fee6f

doc/README.html

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

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. 🙂

OCaml

Innovation. Community. Security.