Crate uquery[][src]

uQuery

A simple way to create beautiful command line experiences. uQuery allows you both to query the user for data, and display user errors and warnings

Example

fn main() {
	uquery::notice("Cli registration form", 1);
	// Asks the user for there favourite food
	let favourite_food = uquery::string("What us your favourite food");

	// Asks the user for their favourite number 
	let favourite_number = uquery::integer("What is your favourite number");

	// Asks the user for their name, defaulting to John Doe
	let name = uquery::string_with_default("What is your name", "John Doe");

	// Asks the user for comfirmation
	match uquery::boolean("Are you sure you have entered the correct details") {
		true => {
			// Tells the user that we are creating a user
			uquery::notice("Creating  User", 3);

			// Prints a mesage about them
			println!(
				"Welcome {}, You will be prepared {} {}s ",
				name,
				favourite_food,
				favourite_number
			);
		}
		false => {
			// Warns the user of not completing the form
			uquery::warning(
				"You have quit the form, you will now not be registered",
				"Redo the form"
			);
		}
	}
}

Functions

bool

Queries the user for boolean input.

boolean_with_default

Queries the user for boolean input.

error

Displays an error to the user.

int

Queries the user for integer input.

int_with_default

Queries the user for integer input.

notice

Notifies the user through a title.

query

Same as query_untrimmed, but this time the result removes leading and trailing spaces

query_untrimmed

Queries the user input.

string

Queries the user for string input.

string_with_default

Queries the user for string input with a default.

warning

Displays a warning to the user.