mcui/input

Command line input helpers

Dependency Graph

mcui/input: Library Dependencies

View color source code (raw) for this file

View reStructuredText (rst) source code for this page

Config

Value parsing functions

These functions all have the same interface.

Upon return, a valid value will be stored in the named variable; if the value was not valid, the function raises an error.

parse_int

Parse a string as an integer

$1 - raw value to parse

$2 - variable name

parse_bool

Parse a string as a boolean

$1 - raw value to parse

$2 - variable name

parse_yesno

Parse a string as a yes or no answer

$1 - raw value to parse

$2 - variable name

parse_yesnocancel

Parse a string as a yes, no, or cancel answer

$1 - raw value to parse

$2 - variable name

parse_onoff

Parse a string as an on or off answer

$1 - raw value to parse

$2 - variable name

Input helpers

read_string

Interactively reads a string into a variable

$1 - prompt

$2 - target variable

read_silent

Same as read_string, but does not echo input.

read_and_parse

Reads a string and parses it into a typed variable

$1 - name of parser function

$2 - prompt

$3 - target variable

Prompt input

Input validation

assert_parse

Asserts variable ($2) is type ($1) or prints error ($3)

$1 - parsing type, used to derive parsing function (e.g. 'parse_int')

$2 - name of variable

$3 - error to display if assertion fails

assert_parse_list

Asserts values ($...) are type ($1) or prints error ($2)

$1 - $ptype, $2 - $error, $3 - $var

Library testing


View the Developer Guide Index

View the Reference Manual Index


Generated on Thu May 4 19:02:34 PDT 2017 by mcsh i7 v0.19.0.