sherlodoc icon indicating copy to clipboard operation
sherlodoc copied to clipboard

Add history to the CLI

Open EmileTrotignon opened this issue 1 year ago • 2 comments

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.

EmileTrotignon avatar Feb 14 '24 17:02 EmileTrotignon

(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 :-°)

art-w avatar Feb 15 '24 12:02 art-w

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.

EmileTrotignon avatar Feb 20 '24 12:02 EmileTrotignon