this repo has no description
1opam-version: "2.0"
2maintainer: "Simon Cruanes"
3authors: "Edgar Aroutiounian <edgar.factorial@gmail.com>"
4homepage: "https://github.com/fxfactorial/ocaml-linenoise"
5bug-reports: "https://github.com/fxfactorial/ocaml-linenoise/issues"
6license: "BSD-3-Clause"
7dev-repo: "git+https://github.com/fxfactorial/ocaml-linenoise.git"
8build: [
9 ["jbuilder" "build" "@install" "-p" name]
10 ["jbuilder" "runtest" "-p" name] {with-test}
11]
12depends: [
13 "ocaml" {< "4.09"}
14 "jbuilder" {>= "1.0+beta7"}
15 "result"
16]
17synopsis: "Simple readline like functionality with nice hints feature."
18description: """
19These are self contained OCaml bindings to linenoise,
20no system libraries needed at all.
21
22Here's a simple program:
23
24let rec user_input prompt cb =
25 match LNoise.linenoise prompt with
26 | None -> ()
27 | Some v ->
28 cb v;
29 user_input prompt cb
30
31let () =
32 LNoise.set_hints_callback (fun line ->
33 if line <> "git remote add " then None
34 else Some (" <this is the remote name> <this is the remote URL>",
35 LNoise.Yellow,
36 true)
37 );
38 LNoise.history_load ~filename:"history.txt" |> ignore;
39 LNoise.history_set ~max_length:100 |> ignore;
40 LNoise.set_completion_callback begin fun line_so_far ln_completions ->
41 if line_so_far <> "" && line_so_far.[0] = 'h' then
42 ["Hey"; "Howard"; "Hughes";"Hocus"]
43 |> List.iter (LNoise.add_completion ln_completions);
44 end;
45 ["These are OCaml bindings to linenoise";
46 "get tab completion with <TAB>, type h then hit <TAB>";
47 "type quit to exit gracefully";
48 "By Edgar Aroutiounian\\n"]
49 |> List.iter print_endline;
50 (fun from_user ->
51 if from_user = "quit" then exit 0;
52 LNoise.history_add from_user |> ignore;
53 LNoise.history_save ~filename:"history.txt" |> ignore;
54 Printf.sprintf "Got: %s" from_user |> print_endline
55 )
56 |> user_input "test_program> "
57
58and compile with:
59$ ocamlfind ocamlopt ex.ml -package linenoise -linkpkg -o T"""
60url {
61 src: "https://github.com/fxfactorial/ocaml-linenoise/archive/v1.1.0.tar.gz"
62 checksum: [
63 "sha256=0ae814442c7ac68b7989bc2b18bb7e426823ba85a386d0e304b58d285c3ec5af"
64 "md5=0d47ce859602ce719fd4372b79255d58"
65 ]
66}