Module bdrck::cli[][src]

Utilities for command-line interfaces.

Structs

MaybePromptedString

MaybePromptedString is a wrapper for getting user input interactively, while also allowing the value to be specified at call time. This is useful e.g. when we want to prompt users interactively, but want to predefine the values in unit tests, or when users can specify a value either interactively or via flags.

TerminalAttributes

This is an opaque structure which encapsulates the state / attributes of an interactive terminal. The contents of this structure are OS-specific.

Enums

Stream

Standard input / output streams.

TerminalFlag

This enum describes high-level terminal flags, in an OS-agnostic way.

Traits

AbstractStream

This trait describes an abstract input or output stream.

AbstractTerminalAttributes

This trait describes an abstract type which describes the attributes of a terminal.

Functions

continue_confirmation

Display a " Continue?" confirmation. Returns true if the user replies "yes" (or similar), or false otherwise.

prompt_for_string

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.

prompt_for_string_confirm

Prompt for a string as per prompt_for_string, but additionally have the user enter the value again to confirm we get the same answer twice. This is useful for e.g. password entry.

Type Definitions

IoResult

An alias for std::io::Result.