mirror of
https://github.com/soywod/himalaya.git
synced 2024-09-05 10:31:13 +00:00
24 lines
581 B
Rust
24 lines
581 B
Rust
use anyhow::Result;
|
|
use dialoguer::Input;
|
|
use dirs::home_dir;
|
|
use email::maildir::MaildirConfig;
|
|
|
|
use crate::{backend::config::BackendConfig, config::wizard::THEME};
|
|
|
|
pub(crate) fn configure() -> Result<BackendConfig> {
|
|
let mut config = MaildirConfig::default();
|
|
|
|
let mut input = Input::with_theme(&*THEME);
|
|
|
|
if let Some(home) = home_dir() {
|
|
input.default(home.join("Mail").display().to_string());
|
|
};
|
|
|
|
config.root_dir = input
|
|
.with_prompt("Maildir directory")
|
|
.interact_text()?
|
|
.into();
|
|
|
|
Ok(BackendConfig::Maildir(config))
|
|
}
|