Expand description
§use-prompt
Prompt text and confirmation primitives for RustUse CLI-adjacent code.
This crate stores prompt text and parses yes/no confirmation answers. It does not implement an interactive UI loop, prompt renderer, or terminal framework.
§Example
use use_prompt::{PromptText, YesNoAnswer, parse_confirmation};
let prompt = PromptText::new("Continue?")?;
let answer = parse_confirmation("yes")?;
assert_eq!(prompt.as_str(), "Continue?");
assert_eq!(answer, YesNoAnswer::Yes);§Scope
Use this crate for prompt vocabulary and confirmation parsing only.
Modules§
- prelude
- Commonly used prompt primitives.
Structs§
- Prompt
Text - Owned prompt text.
Enums§
- Confirmation
Parse Error - Errors returned while parsing confirmation answers.
- Prompt
Text Error - Validation errors for prompt text.
- YesNo
Answer - A primitive yes/no answer.
Functions§
- is_no
- Returns whether
inputparses as no. - is_yes
- Returns whether
inputparses as yes. - parse_
confirmation - Parses a yes/no confirmation answer.