🎨 Create beautiful interactive command line interface in OCaml
  • OCaml 96.5%
  • Makefile 2.6%
  • Dune 0.9%
Find a file
2021-06-04 13:56:52 +02:00
.github/workflows Fix CI 2021-05-19 16:26:10 +02:00
example Implement select 2021-05-19 18:40:38 +02:00
lib Fix issue with cursor save/restore 2021-06-04 13:56:52 +02:00
vendor Implement select 2021-05-19 18:40:38 +02:00
.gitattributes Initial V2 rewriting 2021-05-17 11:55:05 +02:00
.gitignore Initial V2 rewriting 2021-05-17 11:55:05 +02:00
.ocamlformat Initial V2 rewriting 2021-05-17 11:55:05 +02:00
CHANGES.md Fix issue with cursor save/restore 2021-06-04 13:56:52 +02:00
CONTRIBUTING.md Initial V2 rewriting 2021-05-17 11:55:05 +02:00
dune Initial V2 rewriting 2021-05-17 11:55:05 +02:00
dune-project Fix issue with cursor save/restore 2021-06-04 13:56:52 +02:00
inquire.opam Fix issue with cursor save/restore 2021-06-04 13:56:52 +02:00
LICENSE Initial V2 rewriting 2021-05-17 11:55:05 +02:00
Makefile Initial V2 rewriting 2021-05-17 11:55:05 +02:00
README.md Implement raw_select 2021-05-19 17:08:28 +02:00

Inquire

Actions Status

🎨 Create beautiful interactive command line interface in OCaml

Installation

Using Opam

opam install inquire

Using Esy

esy add @opam/inquire

Usage

Confirm

Prompt the user to answer the given message with "y" or "n".

Inquire.confirm "Are you sure?"

Raw List

Prompt the user to chose a value from the given options.

Inquire.raw_select "What's your favorite movie?" ~options:[ "Choice 1" ; "Choice 2" ]

Password

Prompt the user to enter a password that will be hidden with stars (*).

Inquire.password "Enter your password:"

Input

Prompt the user to input a string.

Inquire.input "Enter a value:"

Limitations

Inquire is dead simple. The prompt implementations are ~100 line of code each and manage the terminal control flow themselves. This simplicity comes at a price though:

  • No support for UTF8. This would in principle be relatively easy to implement with a buffer that accumulates the input bytes until it matches an UTF8 value, up to a certain number of bytes. A PR for this would be more than welcome.

Contributing

Take a look at our Contributing Guide.