Packages / rupm

rs-cli-prompt 0.1.0

Terminal prompts for yes/no, choices and text input with defaults, testable with any Read and Write

Install

cargo add rs-cli-prompt --registry rupm

In Ruststudio: Packages, search for rs-cli-prompt, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.

Versions

README

# rs-cli-prompt

Terminal prompts for yes/no, choices and text input with defaults, testable with any Read and Write

Add it with `rupm add rs-cli-prompt` (or `cargo add rs-cli-prompt --registry rupm`).

```rust
use rs_cli_prompt::Prompter;

// In a real program: let mut p = Prompter::stdio();
let input = "y\nBob\n2\n";
let mut p = Prompter::new(input.as_bytes(), Vec::new());

assert!(p.confirm("Continue?", Some(false)).unwrap());
assert_eq!(p.input("Your name", Some("anonymous")).unwrap(), "Bob");
assert_eq!(p.choose("Pick one", &["red", "green", "blue"], None).unwrap(), 1);
```