Skip to content

Repository files navigation

sl-liner Rust

A Rust library offering readline-like functionality.

This was forked from https://gitlab.redox-os.org/redox-os/liner. It has some changes to history (non-duplicating and context sensitive by default) and it supports Windows (10 with an ansi escape capable console).

CONTRIBUTING.md

Featues

  • Autosuggestions
  • Emacs and Vi keybindings
  • Multi-line editing
  • History
  • Basic and filename completions
  • Reverse search
  • Remappable keybindings

Basic Usage

In Cargo.toml:

[dependencies]
sl_liner = "https://github.com/sl-sh-dev/sl-liner"...

In src/main.rs:

externcrate liner;use liner::{Context,Completer};structEmptyCompleter;impl<W: std::io::Write>Completer<W>forEmptyCompleter{fncompletions(&mutself,_start:&str) -> Vec<String>{Vec::new()}}fnmain(){letmut con = Context::new();loop{let res = con.read_line("[prompt]$ ",&mutEmptyCompleter).unwrap();if res.is_empty(){break;}
con.history.push(res.into());}}

See src/main.rs for a more sophisticated example.

License

MIT licensed. See the LICENSE file.

About

Readline like line editor (fork of https://gitlab.redox-os.org/redox-os/liner).

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages