#user-input #input #prompt #user #cli

prompt-input

A simple and lightweight library for user input prompts in Rust, designed to make input handling straightforward

17 releases (1 stable)

Uses new Rust 2024

1.0.0 Mar 9, 2025
0.13.0 Mar 3, 2025
0.12.0 Mar 3, 2025

#485 in Text processing

Download history 95/week @ 2025-01-21 264/week @ 2025-01-28 32/week @ 2025-02-04 11/week @ 2025-02-11 103/week @ 2025-02-18 1271/week @ 2025-02-25 430/week @ 2025-03-04 58/week @ 2025-03-11

1,864 downloads per month

Custom license

6KB
60 lines

prompt-input

A simple and lightweight Rust library for creating user input prompts. The library is designed to simplify input handling in CLI applications, providing a straightforward API to prompt users for input.

Installation

Add prompt-input to your Cargo.toml:

cargo add prompt-input

Usage

Here's a quick example of how to use prompt-input:

use prompt_input::prelude::*;

fn main() {
    let name: String = String::prompt("Enter your name: ");
    let age: Option<u8> = u8::prompt("Enter your age: ");

    if age.is_none() {
        println!("Hello {}!", name);
    } else {
        println!("Hello {}! You are {} years old.", name, age.unwrap());
    }
}

Why Use prompt-input?

  • Reduces boilerplate code for handling user input.
  • Encourages clean and readable CLI application code.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

No runtime deps