| Crates.io | cli-prompt-helper |
| lib.rs | cli-prompt-helper |
| version | 0.1.0 |
| created_at | 2025-11-30 21:02:59.112544+00 |
| updated_at | 2025-11-30 21:02:59.112544+00 |
| description | small light weight crate for helper functions to prompt on stdin/stdout for small CLIs. |
| homepage | https://github.com/thegreatbey/cli-prompt-helper |
| repository | https://github.com/thegreatbey/cli-prompt-helper |
| max_upload_size | |
| id | 1958849 |
| size | 26,443 |
Dependency-free helpers to ask questions on stdin/stdout for small CLIs.
What you get:
All functions block on stdin and use UTF-8. No unsafe code.
use cli_prompt_helper::{prompt_str, prompt_parse, prompt_default, prompt_yes_no};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let name = prompt_str("name: ")?;
let age: u32 = prompt_parse("age: ")?;
let city = prompt_default("city", "London")?;
let proceed = prompt_yes_no("continue?", true)?;
println!("{name} ({age}) from {city}; proceed={proceed}");
Ok(())
}
Or run the included example:
cargo run --example basic
//reduce boilerplate for tiny CLIs //avoid external dependencies for basic stdin/stdout prompts
//no unsafe code //simple, explicit control flow
Licensed under either of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.