Expand description
askit: a simple and ergonomic CLI input library.
Quickstart com Result
:
use askit::prompt;
fn sample() -> Result<(), askit::Error> {
let name: String = prompt("Name: ").get()?;
let age: u8 = prompt("Age [18]: ").default("18").retries(2).get()?;
println!("Hello, {} ({}).", name, age);
Ok(())
}
Quickstart com macro input!
(return only String):
use askit::input;
let name = input!("Name: ");
println!("Hello, {name}");
Re-exports§
pub use prompt_mod::Error;
pub use prompt_mod::Prompt;
pub use prompt_mod::TypedPrompt;
pub use prompt_mod::Validator;
pub use prompt_mod::prompt;
pub use prompt_mod::prompt;
Modules§
Macros§
- input
- Macro
input!
, similar to Python’sinput()
.
Traits§
- ForceOk
- Helper
Result<T, Error>
→ forçar unwrap com panic elegante.