🎨 Create beautiful interactive command line interface in OCaml
opam install inquire
esy add @opam/inquire
Prompt the user to answer the given message with "y" or "n".
Inquire.confirm "Are you sure?"
Prompt the user to chose a value from the given options.
Inquire.raw_select "What's your favorite movie?" ~options:[ "Choice 1" ; "Choice 2" ]
Prompt the user to enter a password that will be hidden with stars (*
).
Inquire.password "Enter your password:"
Prompt the user to input a string.
Inquire.input "Enter a value:"
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.
Take a look at our Contributing Guide.