package inquirer_oc
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=9919506f08c2efde61b1f9ac70b77638
sha512=b8335b71c9b0c28dac0b3e9d961f8593d756c96d5edc35c042acde66a4eb51179439a785c6af844bfd3108802b6ad287de5a4476126227347ceade46e795608f
Description
A collection of common interactive command line user interfaces
Tags
answer answers ask base cli command command-line confirm enquirer generate generator hyper input inquire inquirerAdded to opam-repository:
README
inquirer_oc
What does "inquirer_oc" library do?
Allow interaction on the CLI For example, you can have the user select one from multiple lists.
Currently, three types of question formats are implemented.
- list
- input
- confirm
usage
list
open Inquirer_oc
let question_option : Question_list_type.question =
{
name = "flower";
prompt_type = List;
message = "What's your favorite flower?";
choices =
[
{ word = "Sunflower"; value = "sunflower" };
{ word = "Tulip"; value = "tulip" };
{ word = "Rose"; value = "rose" };
{ word = "Daisy"; value = "daisy" };
{ word = "Lily"; value = "lily" };
];
page_size = Some 5;
}
let result = Question_list.list_question question_option
let () = print_endline resultimage 
advanced
If you want a simple string list with word and value together, there is a function to convert.
open Inquirer_oc
(* string list *)
let flower_list = [ "sunflower"; "tulip"; "rose"; "daisy"; "lily" ]
let question_option : Question_list_type.question =
{
name = "flower";
prompt_type = List;
message = "What's your favorite flower?";
(* convert choices string x -> {word: x; value: x} *)
choices = Question_list.string_list_to_choice_list flower_list;
page_size = Some 5;
}
let result = Question_list.list_question question_option
let () = print_endline resultinput
open Inquirer_oc
let question_option : Question_input_type.question_input_option =
{
name = "flower";
prompt_type = Input;
message = "What's your favorite flower?";
default = Some "rose";
}
let result = Question_input.question_input question_option
let () = print_endline resultimage 
confirm
open Inquirer_oc
let question_option : Question_confirm_type.question_confirm_option =
{
name = "confirm";
message = "Are you sure?";
prompt_type = Confirm;
default = Some true;
}
let result = Question_confirm.inquirer_confirm question_option
let () = print_string (string_of_bool result)image 
Dev Dependencies (1)
-
odoc
with-doc
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building inquirer_oc with each compiler on check.ci.ocaml.org, run of against opam-repository 8d8d144. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 1.0.15 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure