mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-16 04:17:56 +08:00
53 lines
1.6 KiB
Rust
53 lines
1.6 KiB
Rust
// This file is part of Himalaya, a CLI to manage emails.
|
|
//
|
|
// Copyright (C) 2022-2026 soywod <pimalaya.org@posteo.net>
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify it under
|
|
// the terms of the GNU Affero General Public License as published by the Free
|
|
// Software Foundation, either version 3 of the License, or (at your option) any
|
|
// later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
// details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
mod account;
|
|
mod backend;
|
|
mod cli;
|
|
mod config;
|
|
#[cfg(feature = "imap")]
|
|
mod imap;
|
|
#[cfg(feature = "jmap")]
|
|
mod jmap;
|
|
#[cfg(feature = "maildir")]
|
|
mod maildir;
|
|
mod shared;
|
|
#[cfg(feature = "smtp")]
|
|
mod smtp;
|
|
mod wizard;
|
|
|
|
use anyhow::Result;
|
|
use clap::Parser;
|
|
use pimalaya_cli::{error::ErrorReport, log::Logger, printer::StdoutPrinter};
|
|
|
|
use crate::cli::HimalayaCli;
|
|
|
|
fn main() {
|
|
let cli = HimalayaCli::parse();
|
|
let mut printer = StdoutPrinter::new(&cli.json);
|
|
let result = execute(cli, &mut printer);
|
|
ErrorReport::eval(&mut printer, result);
|
|
}
|
|
|
|
fn execute(cli: HimalayaCli, printer: &mut StdoutPrinter) -> Result<()> {
|
|
Logger::try_init(&cli.log)?;
|
|
let config = cli.config_paths.as_ref();
|
|
let account = cli.account.name.as_deref();
|
|
let backend = cli.backend;
|
|
cli.command.execute(printer, config, account, backend)
|
|
}
|