4 releases (2 breaking)

0.3.0 Apr 19, 2024
0.2.1 Apr 18, 2024
0.2.0 Apr 18, 2024
0.1.0 Apr 18, 2024

#31 in #tty

Download history 2/week @ 2024-05-26 2/week @ 2024-06-02 1/week @ 2024-06-30 10/week @ 2024-07-07 28/week @ 2024-07-28

108 downloads per month
Used in transipctl

MIT license

14KB
307 lines

build-badge License: MIT docs.rs Crates.io

rusty-lines

Rusty-lines is a library that abstracts the way lines are read from a tty or from a file. When using the file lines reader you can optionally replace environment variables names with their values.

It uses rustyline for reading from tty.

Example using tty

use rusty_lines::TTYLinesBuilder;

fn main() {
    let lines = TTYLinesBuilder::prompt("tip")
        .exit_on(&["exit"])
        .history("history.txt")
        .build()
        .unwrap();
}

Example using file

use rusty_lines::FileLinesBuilder;

fn main() {
    let lines = FileLinesBuilder::file("Cargo.toml")
        .build()
        .unwrap();
}

Dependencies

~6–15MB
~187K SLoC