mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-15 20:07:57 +08:00
24 lines
687 B
Rust
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"))
|
|
}
|
|
}
|