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. --- src/backends/mod.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/backends/mod.rs') diff --git a/src/backends/mod.rs b/src/backends/mod.rs index f5af7ef..5ae3cef 100644 --- a/src/backends/mod.rs +++ b/src/backends/mod.rs @@ -2,9 +2,11 @@ // SPDX-License-Identifier: MIT mod dialog; +mod stdio; mod zenity; pub use crate::backends::dialog::Dialog; +pub use crate::backends::stdio::Stdio; pub use crate::backends::zenity::Zenity; use std::env; @@ -49,6 +51,7 @@ pub(crate) fn is_available(name: &str) -> bool { pub(crate) fn from_str(s: &str) -> Option> { match s.to_lowercase().as_ref() { "dialog" => Some(Box::new(Dialog::new())), + "stdio" => Some(Box::new(Stdio::new())), "zenity" => Some(Box::new(Zenity::new())), _ => None, } -- cgit v1.2.1