mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-08 10:35:13 +00:00
Since Himalaya is intended to be ran as a CLI in the terminal emulator environment, their user experience could vastly improve with better and more colorful error messages and logging. This change will replace more minimal libraries for error-reporting/han- dling with their more advanced counterparts. Since these crates have tight integrations, this commit will change both in one shot. Also we have don't need env_logger any more. So I also have removed that guy as well. Signed-off-by: Perma Alesheikh <me@prma.dev>
24 lines
581 B
Rust
24 lines
581 B
Rust
use color_eyre::Result;
|
|
use dialoguer::Input;
|
|
use dirs::home_dir;
|
|
use email::maildir::config::MaildirConfig;
|
|
|
|
use crate::{backend::config::BackendConfig, ui::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))
|
|
}
|