Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tmattio/inquire
:art: Create beautiful interactive command line interface in OCaml
https://github.com/tmattio/inquire
cli inquire interactive ocaml reason
Last synced: 11 days ago
JSON representation
:art: Create beautiful interactive command line interface in OCaml
- Host: GitHub
- URL: https://github.com/tmattio/inquire
- Owner: tmattio
- License: mit
- Created: 2020-02-10T12:36:13.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-04T11:57:26.000Z (over 3 years ago)
- Last Synced: 2024-08-04T01:28:38.814Z (3 months ago)
- Topics: cli, inquire, interactive, ocaml, reason
- Language: OCaml
- Homepage: https://tmattio.github.io/inquire
- Size: 529 KB
- Stars: 42
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - inquire
README
# Inquire
[![Actions Status](https://github.com/tmattio/inquire/workflows/CI/badge.svg)](https://github.com/tmattio/inquire/actions)
🎨 Create beautiful interactive command line interface in OCaml
## Installation
### Using Opam
```bash
opam install inquire
```### Using Esy
```bash
esy add @opam/inquire
```## Usage
### Confirm
Prompt the user to answer the given message with "y" or "n".
```ocaml
Inquire.confirm "Are you sure?"
```### Raw List
Prompt the user to chose a value from the given options.
```ocaml
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 (`*`).
```ocaml
Inquire.password "Enter your password:"
```### Input
Prompt the user to input a string.
```ocaml
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](CONTRIBUTING.md).