aboutsummaryrefslogtreecommitdiff
path: root/src/backends
diff options
context:
space:
mode:
Diffstat (limited to 'src/backends')
-rw-r--r--src/backends/mod.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backends/mod.rs b/src/backends/mod.rs
index b9cecd0..20cb8c1 100644
--- a/src/backends/mod.rs
+++ b/src/backends/mod.rs
@@ -31,3 +31,11 @@ pub trait Backend {
/// Shows the given question dialog and returns the choice.
fn show_question(&self, question: &super::Question) -> Result<super::Choice>;
}
+
+pub(crate) fn from_str(s: &str) -> Option<Box<dyn Backend>> {
+ match s.to_lowercase().as_ref() {
+ "dialog" => Some(Box::new(Dialog::new())),
+ "zenity" => Some(Box::new(Zenity::new())),
+ _ => None,
+ }
+}