art-w / sherlodoc

Fuzzy type search for OCaml documentation
MIT License
70 stars 6 forks source link

Add history to the CLI #31

Open EmileTrotignon opened 7 months ago

EmileTrotignon commented 7 months ago

When you use the CLI in toplevel mode :

$ sherlodoc search

You can type search queries and get results. However, you might want to type a query, and then modify it. You can copy paste the query, but this is not very practical.

We should implement search history were you can access previous queries by using the up arrow key.

For now, I do not want to store the history between session, there is no need to write it to a file.

art-w commented 7 months ago

(In the mean time, I personally use the command rlwrap sherlodoc search which relies on the well-known(?) rlwrap utility to add line-edition and history to any program... so we could also document this trick in the readme :-°)

EmileTrotignon commented 6 months ago

I looked up which library would work well to implement this, as art-w told me the getting the arrows keypresses might be hard.

I found one : https://ocaml-community.github.io/lambda-term/3.1.0/lambda-term/LTerm/index.html, but it is indeed quite complicated to get keypresses, it also requires using Lwt, so I am bumping this to a large issue.