Function bdrck::cli::prompt_for_string
source · [−]pub fn prompt_for_string<IS: AbstractStream, OS: AbstractStream>(
input_stream: IS,
output_stream: OS,
prompt: &str,
is_sensitive: bool
) -> Result<String>
Expand description
Prompt the user for a string (read from the given input stream) using the given output stream (typically standard output or standard error) to display the given prompt message.
If is_sensitive
is true, then the users characters will not be echoed back
(e.g. this will behave like a password prompt).
Note that there are various requirements for the given streams, and this function will return an error if any of them are not met:
- Both
input_stream
andoutput_stream
must be TTYs. input_stream
must return a validRead
instance.output_stream
must return a validWrite
instance.