Module bdrck::cli

source · []
Expand description

Utilities for command-line interfaces.

Structs

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.

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

Enums

Standard input / output streams.

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

Traits

This trait describes an abstract input or output stream.

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

Functions

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

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 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

An alias for std::io::Result.