interviewer

Crates.iointerviewer
lib.rsinterviewer
version0.1.1
sourcesrc
created_at2022-08-06 19:49:13.018248
updated_at2022-08-10 20:57:41.555826
descriptionSimple CLI prompting crate
homepage
repositoryhttps://github.com/misobarisic/interviewer
max_upload_size
id639962
size49,695
Mišo Barišić (misobarisic)

documentation

README

interviewer

Continuous Integration License Crates release (latest by date) Downloads Docs GitHub code size in bytes

A simple CLI prompting crate for Rust.

Features include:

  • Consecutive prompts

  • Prompts for several types, and extensible

  • Custom delimiters

Usage

No need to chit-chat. Examples are much better:

use interviewer::{ask, ask_opt, ask_until, ask_many, Separator};

// Ask once
let num: i32 = ask("Enter an i32: ").unwrap_or(0);

// Ask until valid input
let num: f32 = ask_until("Enter an f32: ");

// Optionally ask for a value. Empty input returns None.
let s: Option<String> = ask_opt("Enter something: ");

// Ask for multiple bools separated by a ","
let bools: Vec<bool> = ask_many("Enter bools separated by a ',': ", Separator::SequenceTrim(",")).unwrap();

Commit count: 12

cargo fmt