From 84bfea7add93a98f83ad958151cca718c33bc0a4 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 11 Jan 2019 02:31:29 +0000 Subject: Add the stdio backend This patch adds the stdio backend which acts as a fallback backend and uses standard input and output. For password queries, the rpassword crate is used to suppress output. Also, default_backend is changed to return Stdio if Dialog is not available. --- examples/backend-stdio.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 examples/backend-stdio.rs (limited to 'examples/backend-stdio.rs') diff --git a/examples/backend-stdio.rs b/examples/backend-stdio.rs new file mode 100644 index 0000000..6dbeb8d --- /dev/null +++ b/examples/backend-stdio.rs @@ -0,0 +1,13 @@ +// Copyright (C) 2019 Robin Krahl +// SPDX-License-Identifier: MIT + +use dialog::backends; +use dialog::DialogBox; + +fn main() -> dialog::Result<()> { + let backend = backends::Stdio::new(); + + dialog::Message::new("This is a message.") + .title("And this is a title:") + .show_with(&backend) +} -- cgit v1.2.1