| Crates.io | yes-or-no |
| lib.rs | yes-or-no |
| version | 0.2.0 |
| created_at | 2024-07-31 21:19:48.767019+00 |
| updated_at | 2025-12-29 12:00:40.780831+00 |
| description | Very simple yes or no CLI tool |
| homepage | https://github.com/AntoineRenaud91/yes-or-no |
| repository | https://github.com/AntoineRenaud91/yes-or-no |
| max_upload_size | |
| id | 1321328 |
| size | 18,248 |
A very simple yes or no CLI tool
Add yes-or-no to your project's dependencies:
[dependencies]
yes-or-no = "0.1"
Here is an example of how to use yes-or-no in your Rust project:
use yes_or_no::yes_or_no;
fn main() -> std::io::Result<()> {
match yes_or_no("🦀 Do you like Rust? 🦀", true)? {
Some(true) => println!("You like Rust! 🤩"),
Some(false) => println!("You don't like Rust... ðŸ˜"),
None => println!("Cancelled."),
}
Ok(())
}
When you run the program, you'll be presented with a prompt in your terminal:
🦀 Do you like Rust? 🦀 Yes [✓] No [ ]
None).The function returns io::Result<Option<bool>>:
Ok(Some(true)) - User selected "Yes"Ok(Some(false)) - User selected "No" (or pressed Escape)Ok(None) - User cancelled with Ctrl+CErr(_) - A terminal I/O error occurred