Readline - a pure go implementation of a libreadline-style library

Hi, all!
Readline is pure go library that provides line-editing and history capability for interactive users with a command-line interface. It works well in OSX/Linux/Windows.
It supports:

  • backward/forward history search just like zsh.
  • emacs/vi mode. (emacs by default)
  • support colourful prompt in windows additional.
  • more useful tab-completion just like zsh.

Github: https://github.com/chzyer/readline

3 Likes

This is very neat, although I’ve yet to look at the full details. :wink: There are a few similar things out there, but most were lacking in one way or another when I was last trying to use one to build an interactive-shell like experience. For the record, the things that annoyed me then was getting the combination of:

  • Customizable history. I.e. some commands I may not want to add to history, duplicates are sometimes useful sometimes not, etc so this really needs to be handled by the application and not decided fully by the readline package.

  • Customizable word for word tab completion. I needed to be able to support completing commands with subcommands, so not just a “line” but word for word. Ideally with placeholder support, although this can be handled by the application if the completer gets to see all keystrokes. x/crypto/ssh/terminal gets this mostly right.

:slight_smile:

@calmh You make a good point and I am appreciated for that!

Looks very thorough.

I’ve been using https://github.com/peterh/liner which is a similar library - how would you say they differ?

Thanks

Nick

@ncw
liner and readline are both have the same goal, and they are almost provide the same features.

If I have to say the differents between them:

  • The user experiences of liner is more like bash and readline's is zsh.
  • readline have a better UI/UE of tab-completion
  • readline supports vi mode
  • liner has more compatibility and stability than readline. readline is just a 10-days-old repo. It has a long way to go and needs anyone’s help.

:grinning:

3 Likes

Thanks for the explanation. I’ll try it out!

– Nick

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.