From 4875863ceb3acfe6d2ab17c9f76df49adb9473a7 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 11 Jan 2019 03:41:30 +0100 Subject: Add usage example to readme --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 3af0e10..d2439b0 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,27 @@ A Rust library for displaying dialog boxes using various backends. [Documentation][] +Currently `dialog-rs` supports input, message, password and question dialogs. +It can use the `dialog` or `zenity` tools to display the dialog boxes. If none +of these tools is available, the dialogs are printed to the standard output. + +## Example + +```rust +use dialog::DialogBox; + +let choice = dialog::Question::new("Would you like to install Rust?") + .title("Rust Installation") + .show() + .expect("Could not display dialog box"); +if choice == dialog::Choice::Yes { + dialog::Message::new("You made the right choice!") + .title("Rust Installation") + .show() + .expect("Could not display dialog box"); +} +``` + ## Contact For bug reports, patches, feature requests or other messages, please send a -- cgit v1.2.1