Struct stdcli::term::Input
[−]
[src]
pub struct Input { /* fields omitted */ }
Renders a simple input prompt.
Example usage
use dialoguer::Input; let name = Input::new("Your name").interact()?; println!("Name: {}", name);
Methods
impl Input
[src]
fn new(text: &str) -> Input
[src]
Creates a new input prompt.
fn clear(&mut self, val: bool) -> &mut Input
[src]
Sets the clear behavior of the prompt.
The default is not to clear.
fn default(&mut self, s: &str) -> &mut Input
[src]
Sets a default.
Out of the box the prompt does not have a default and will continue to display until the user hit enter. If a default is set the user can instead accept the default with enter.
fn show_default(&mut self, val: bool) -> &mut Input
[src]
Disables or enables the default value display.
The default is to append [default]
to the prompt to tell the
user that a default is acceptable.
fn interact(&self) -> Result<String, Error>
[src]
Enables user interaction and returns the result.
If the user confirms the result is true
, false
otherwise.
The dialog is rendered on stderr.
fn interact_on(&self, term: &Term) -> Result<String, Error>
[src]
Like interact
but allows a specific terminal to be set.