#input #terminal #issue

promptput

A simple crate for handling terminal input

2 releases

0.1.1 Oct 24, 2024
0.1.0 Oct 24, 2024

#41 in #issue

Download history 179/week @ 2024-10-19 64/week @ 2024-10-26 18/week @ 2024-11-02 3/week @ 2024-11-09 11/week @ 2024-11-16 14/week @ 2024-11-23 9/week @ 2024-11-30 29/week @ 2024-12-07

63 downloads per month

MIT license

3KB

Promptput

Promptput is a simple and intuitive crate for handling terminal user input in Rust. It allows you to prompt the user with a message and capture their input as the desired data type. It is inspired by the input() method in Python.

Installation

Add this to your Cargo.toml:

[dependencies]
promptput = "0.1"

Usage

Here's a simple example of how to use promptput:

use promptput::input;

fn main() {
    let name: &str = input("Name: ");
    let age: i32 = input("Age: ");

    println!("Name: {name}, Age: {age}");
}

How it Works

The input() function takes a prompt &str and returns the user input, automatically converting it into the specified data type.

Contributing

Feel free to open issues or submit pull requests if you have any improvements or suggestions.

No runtime deps