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

24 lines
687 B
Rust

use anyhow::Result;
use clap::Parser;
use pimalaya_cli::printer::{Message, Printer};
use crate::imap::{client::ImapClient, mailbox::arg::MailboxNameArg};
/// Create the given mailbox.
///
/// This command allows you to create a new mailbox using the given
/// name.
#[derive(Debug, Parser)]
pub struct ImapMailboxCreateCommand {
#[command(flatten)]
pub mailbox_name: MailboxNameArg,
}
impl ImapMailboxCreateCommand {
pub fn execute(self, printer: &mut impl Printer, mut client: ImapClient) -> Result<()> {
let mailbox = self.mailbox_name.inner.try_into()?;
client.create(mailbox)?;
printer.out(Message::new("Mailbox successfully created"))
}
}