caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Gnu readline functionality in ocaml?
@ 2019-07-02 16:48 Helmut Brandl
  2019-07-02 16:51 ` Martin Riener
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Helmut Brandl @ 2019-07-02 16:48 UTC (permalink / raw)
  To: caml users

Hello list,

is there a possibility to write an interactive console program in ocaml using a functionality like gnu’s readline i.e. allowing the user to press e.g. arrow up to get the previous line?

Regards
Helmut

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Gnu readline functionality in ocaml?
  2019-07-02 16:48 [Caml-list] Gnu readline functionality in ocaml? Helmut Brandl
@ 2019-07-02 16:51 ` Martin Riener
  2019-07-02 17:02   ` Simon Cruanes
  2019-07-02 18:13 ` rixed
  2019-07-03  9:41 ` SP
  2 siblings, 1 reply; 8+ messages in thread
From: Martin Riener @ 2019-07-02 16:51 UTC (permalink / raw)
  To: Helmut Brandl, caml users


[-- Attachment #1.1: Type: text/plain, Size: 576 bytes --]

Hello Helmut,

You are probably looking for utop ( https://opam.ocaml.org/packages/utop/ )
which also has autocompletion and other nice features. Alternatively, you can
use rlwrap ( https://linux.die.net/man/1/rlwrap ) to wrap any non-readline
program into readline.

cheers,
Martin

On 7/2/19 6:48 PM, Helmut Brandl wrote:
> Hello list,
> 
> is there a possibility to write an interactive console program in ocaml using a functionality like gnu’s readline i.e. allowing the user to press e.g. arrow up to get the previous line?
> 
> Regards
> Helmut
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Gnu readline functionality in ocaml?
  2019-07-02 16:51 ` Martin Riener
@ 2019-07-02 17:02   ` Simon Cruanes
  2019-07-02 17:26     ` Helmut Brandl
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Cruanes @ 2019-07-02 17:02 UTC (permalink / raw)
  To: Martin Riener; +Cc: Helmut Brandl, caml users

[-- Attachment #1: Type: text/plain, Size: 117 bytes --]

There are also self-contained linenoise bindings (`opam info linenoise`)
that are reasonably simple and lightweight.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Gnu readline functionality in ocaml?
  2019-07-02 17:02   ` Simon Cruanes
@ 2019-07-02 17:26     ` Helmut Brandl
  0 siblings, 0 replies; 8+ messages in thread
From: Helmut Brandl @ 2019-07-02 17:26 UTC (permalink / raw)
  To: caml users

Thanks for the answers. It seems that “line noise” is exactly what I need.



> On Jul 2, 2019, at 12:02, Simon Cruanes <simon.cruanes.2007@m4x.org> wrote:
> 
> There are also self-contained linenoise bindings (`opam info linenoise`)
> that are reasonably simple and lightweight.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Gnu readline functionality in ocaml?
  2019-07-02 16:48 [Caml-list] Gnu readline functionality in ocaml? Helmut Brandl
  2019-07-02 16:51 ` Martin Riener
@ 2019-07-02 18:13 ` rixed
  2019-07-03  9:41 ` SP
  2 siblings, 0 replies; 8+ messages in thread
From: rixed @ 2019-07-02 18:13 UTC (permalink / raw)
  To: caml-list

This is unrelated to OCaml, but are you aware of tools such as rlwrap ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Gnu readline functionality in ocaml?
  2019-07-02 16:48 [Caml-list] Gnu readline functionality in ocaml? Helmut Brandl
  2019-07-02 16:51 ` Martin Riener
  2019-07-02 18:13 ` rixed
@ 2019-07-03  9:41 ` SP
  2019-07-04  1:05   ` Francois Berenger
  2 siblings, 1 reply; 8+ messages in thread
From: SP @ 2019-07-03  9:41 UTC (permalink / raw)
  To: caml-list

I had a look for you on opam.ocaml.org.

I found [linenoise][1]. Also looked at [utop's code][2] and it seems to use [lambda-term][3][4].


[1]: https://opam.ocaml.org/packages/linenoise
[2]: https://github.com/ocaml-community/utop/blob/master/src/lib/uTop_complete.ml
[3]: https://opam.ocaml.org/packages/lambda-term
[4]: https://github.com/ocaml-community/lambda-term/blob/master/src/lTerm_read_line.mli


Hope this helps.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Gnu readline functionality in ocaml?
  2019-07-03  9:41 ` SP
@ 2019-07-04  1:05   ` Francois Berenger
  2019-07-04  8:50     ` Jeremie Dimino
  0 siblings, 1 reply; 8+ messages in thread
From: Francois Berenger @ 2019-07-04  1:05 UTC (permalink / raw)
  To: caml-list

On 03/07/2019 18:41, SP wrote:
> I had a look for you on opam.ocaml.org.
> 
> I found [linenoise][1]. Also looked at [utop's code][2] and it seems
> to use [lambda-term][3][4].

lambda-term uses zed, which from the opam description looks like
the library providing the readline-like functionality.

https://github.com/ocaml-community/zed

> [1]: https://opam.ocaml.org/packages/linenoise
> [2]:
> https://github.com/ocaml-community/utop/blob/master/src/lib/uTop_complete.ml
> [3]: https://opam.ocaml.org/packages/lambda-term
> [4]:
> https://github.com/ocaml-community/lambda-term/blob/master/src/lTerm_read_line.mli
> 
> 
> Hope this helps.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Gnu readline functionality in ocaml?
  2019-07-04  1:05   ` Francois Berenger
@ 2019-07-04  8:50     ` Jeremie Dimino
  0 siblings, 0 replies; 8+ messages in thread
From: Jeremie Dimino @ 2019-07-04  8:50 UTC (permalink / raw)
  To: Francois Berenger; +Cc: caml users

More precisely, zed implements the part of text edition that is
completely independent of the actual user interface. Lambda-term on
the other hand is a comprehensive terminal library that among other
things relies on zed to provide readline-like functionality and text
edition widgets by "connecting" zed to the terminal operations. But
for instance, it would be straightforward to create a simple text
editor using zed and notty.

On Thu, Jul 4, 2019 at 2:05 AM Francois Berenger <mlists@ligand.eu> wrote:
>
> On 03/07/2019 18:41, SP wrote:
> > I had a look for you on opam.ocaml.org.
> >
> > I found [linenoise][1]. Also looked at [utop's code][2] and it seems
> > to use [lambda-term][3][4].
>
> lambda-term uses zed, which from the opam description looks like
> the library providing the readline-like functionality.
>
> https://github.com/ocaml-community/zed
>
> > [1]: https://opam.ocaml.org/packages/linenoise
> > [2]:
> > https://github.com/ocaml-community/utop/blob/master/src/lib/uTop_complete.ml
> > [3]: https://opam.ocaml.org/packages/lambda-term
> > [4]:
> > https://github.com/ocaml-community/lambda-term/blob/master/src/lTerm_read_line.mli
> >
> >
> > Hope this helps.



-- 
Jeremie

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-07-04  8:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 16:48 [Caml-list] Gnu readline functionality in ocaml? Helmut Brandl
2019-07-02 16:51 ` Martin Riener
2019-07-02 17:02   ` Simon Cruanes
2019-07-02 17:26     ` Helmut Brandl
2019-07-02 18:13 ` rixed
2019-07-03  9:41 ` SP
2019-07-04  1:05   ` Francois Berenger
2019-07-04  8:50     ` Jeremie Dimino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).