Files
himalaya/src/imap/flag/cli.rs
T
Clément DOUIN cd27969e14 clean part 1
2026-05-20 00:54:16 +02:00

35 lines
966 B
Rust

use anyhow::Result;
use clap::Subcommand;
use pimalaya_cli::printer::Printer;
use crate::imap::{
client::ImapClient,
flag::{
add::ImapFlagAddCommand, list::ImapFlagListCommand, remove::ImapFlagRemoveCommand,
set::ImapFlagSetCommand,
},
};
/// Manage IMAP flags.
///
/// A flag is a label attached to a message. This subcommand allows
/// you to manage them.
#[derive(Debug, Subcommand)]
pub enum ImapFlagCommand {
List(ImapFlagListCommand),
Add(ImapFlagAddCommand),
Set(ImapFlagSetCommand),
Remove(ImapFlagRemoveCommand),
}
impl ImapFlagCommand {
pub fn execute(self, printer: &mut impl Printer, client: ImapClient) -> Result<()> {
match self {
Self::List(cmd) => cmd.execute(printer, client),
Self::Add(cmd) => cmd.execute(printer, client),
Self::Set(cmd) => cmd.execute(printer, client),
Self::Remove(cmd) => cmd.execute(printer, client),
}
}
}