aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-11 02:31:29 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-01-11 03:32:45 +0100
commit84bfea7add93a98f83ad958151cca718c33bc0a4 (patch)
treecd860c19962398c06b17f383931441787a6e786e /examples
parentdc754cbc9763b3ea6979ed55bd4e8030fe073078 (diff)
downloaddialog-rs-84bfea7add93a98f83ad958151cca718c33bc0a4.tar.gz
dialog-rs-84bfea7add93a98f83ad958151cca718c33bc0a4.tar.bz2
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.
Diffstat (limited to 'examples')
-rw-r--r--examples/backend-stdio.rs13
1 files changed, 13 insertions, 0 deletions
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 <robin.krahl@ireas.org>
+// 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)
+}