Files
himalaya/src/imap/envelope/cli.rs
T
Clément DOUIN 8416a41f99 use std clients
2026-05-20 00:54:16 +02:00

39 lines
1.2 KiB
Rust

use anyhow::Result;
use clap::Subcommand;
use pimalaya_cli::printer::Printer;
use crate::imap::{
account::ImapAccount,
envelope::{
get::ImapEnvelopeGetCommand, list::ImapEnvelopeListCommand,
search::ImapEnvelopeSearchCommand, sort::ImapEnvelopeSortCommand,
thread::ImapEnvelopeThreadCommand,
},
};
/// Manage IMAP envelopes.
///
/// An envelope contains header information about a message such as
/// date, subject, from, to, cc, bcc, etc. This subcommand allows you
/// to get, list, search, sort, and thread envelopes.
#[derive(Debug, Subcommand)]
pub enum ImapEnvelopeCommand {
Get(ImapEnvelopeGetCommand),
List(ImapEnvelopeListCommand),
Search(ImapEnvelopeSearchCommand),
Sort(ImapEnvelopeSortCommand),
Thread(ImapEnvelopeThreadCommand),
}
impl ImapEnvelopeCommand {
pub fn execute(self, printer: &mut impl Printer, account: ImapAccount) -> Result<()> {
match self {
Self::Get(cmd) => cmd.execute(printer, account),
Self::List(cmd) => cmd.execute(printer, account),
Self::Search(cmd) => cmd.execute(printer, account),
Self::Sort(cmd) => cmd.execute(printer, account),
Self::Thread(cmd) => cmd.execute(printer, account),
}
}
}