mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-16 20:57:53 +08:00
clean cargo features
This commit is contained in:
@@ -231,17 +231,17 @@ impl TomlAccountConfig {
|
||||
used_backends.extend(folder.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(feature = "envelope-command")]
|
||||
#[cfg(feature = "envelope-subcmd")]
|
||||
if let Some(ref envelope) = self.envelope {
|
||||
used_backends.extend(envelope.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(feature = "flag-command")]
|
||||
#[cfg(feature = "flag-subcmd")]
|
||||
if let Some(ref flag) = self.flag {
|
||||
used_backends.extend(flag.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(feature = "message-command")]
|
||||
#[cfg(feature = "message-subcmd")]
|
||||
if let Some(ref msg) = self.message {
|
||||
used_backends.extend(msg.get_used_backends());
|
||||
}
|
||||
|
||||
+9
-14
@@ -56,8 +56,10 @@ use email::imap::{ImapSessionBuilder, ImapSessionSync};
|
||||
use email::maildir::config::MaildirConfig;
|
||||
#[cfg(feature = "maildir")]
|
||||
use email::maildir::{MaildirSessionBuilder, MaildirSessionSync};
|
||||
#[cfg(all(feature = "message-add", feature = "imap"))]
|
||||
use email::message::add::imap::AddImapMessage;
|
||||
#[cfg(all(feature = "message-add", feature = "maildir"))]
|
||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
||||
use email::message::add::maildir::AddMaildirMessage;
|
||||
#[cfg(all(feature = "message-copy", feature = "imap"))]
|
||||
use email::message::copy::imap::CopyMessagesImap;
|
||||
#[cfg(all(feature = "message-copy", feature = "maildir"))]
|
||||
@@ -74,8 +76,6 @@ use email::message::peek::imap::PeekMessagesImap;
|
||||
use email::message::peek::maildir::PeekMessagesMaildir;
|
||||
#[cfg(any(feature = "message-peek", feature = "message-get"))]
|
||||
use email::message::Messages;
|
||||
#[cfg(all(feature = "message-add", feature = "imap"))]
|
||||
use email::message::{add::imap::AddMessageImap, add_with_flags::imap::AddMessageWithFlagsImap};
|
||||
#[cfg(feature = "sendmail")]
|
||||
use email::sendmail::SendmailContext;
|
||||
#[cfg(feature = "smtp")]
|
||||
@@ -650,25 +650,20 @@ impl BackendBuilder {
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
backend_builder = backend_builder
|
||||
.with_add_message(|ctx| ctx.imap.as_ref().and_then(AddMessageImap::new))
|
||||
.with_add_message_with_flags(|ctx| {
|
||||
ctx.imap.as_ref().and_then(AddMessageWithFlagsImap::new)
|
||||
});
|
||||
.with_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new))
|
||||
.with_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||
}
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(BackendKind::Maildir) => {
|
||||
backend_builder = backend_builder.with_add_message_with_flags(|ctx| {
|
||||
ctx.maildir
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
});
|
||||
backend_builder = backend_builder
|
||||
.with_add_message(|ctx| ctx.maildir.as_ref().and_then(AddMaildirMessage::new));
|
||||
}
|
||||
#[cfg(feature = "sync")]
|
||||
Some(BackendKind::MaildirForSync) => {
|
||||
backend_builder = backend_builder.with_add_message_with_flags(|ctx| {
|
||||
backend_builder = backend_builder.with_add_message(|ctx| {
|
||||
ctx.maildir_for_sync
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
.and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "notmuch")]
|
||||
|
||||
+21
-21
@@ -2,19 +2,19 @@ use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[cfg(feature = "account-command")]
|
||||
#[cfg(feature = "account-subcmd")]
|
||||
use crate::account::command::AccountSubcommand;
|
||||
#[cfg(feature = "envelope-command")]
|
||||
#[cfg(feature = "envelope-subcmd")]
|
||||
use crate::envelope::command::EnvelopeSubcommand;
|
||||
#[cfg(feature = "flag-command")]
|
||||
#[cfg(feature = "flag-subcmd")]
|
||||
use crate::flag::command::FlagSubcommand;
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
use crate::folder::command::FolderSubcommand;
|
||||
#[cfg(feature = "attachment-command")]
|
||||
#[cfg(feature = "attachment-subcmd")]
|
||||
use crate::message::attachment::command::AttachmentSubcommand;
|
||||
#[cfg(feature = "message-command")]
|
||||
#[cfg(feature = "message-subcmd")]
|
||||
use crate::message::command::MessageSubcommand;
|
||||
#[cfg(feature = "template-command")]
|
||||
#[cfg(feature = "template-subcmd")]
|
||||
use crate::message::template::command::TemplateSubcommand;
|
||||
#[allow(unused)]
|
||||
use crate::{
|
||||
@@ -88,38 +88,38 @@ pub struct Cli {
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
pub enum HimalayaCommand {
|
||||
#[cfg(feature = "account-command")]
|
||||
#[cfg(feature = "account-subcmd")]
|
||||
#[command(subcommand)]
|
||||
#[command(alias = "accounts")]
|
||||
Account(AccountSubcommand),
|
||||
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
#[command(subcommand)]
|
||||
#[command(visible_alias = "mailbox", aliases = ["mailboxes", "mboxes", "mbox"])]
|
||||
#[command(alias = "folders")]
|
||||
Folder(FolderSubcommand),
|
||||
|
||||
#[cfg(feature = "envelope-command")]
|
||||
#[cfg(feature = "envelope-subcmd")]
|
||||
#[command(subcommand)]
|
||||
#[command(alias = "envelopes")]
|
||||
Envelope(EnvelopeSubcommand),
|
||||
|
||||
#[cfg(feature = "flag-command")]
|
||||
#[cfg(feature = "flag-subcmd")]
|
||||
#[command(subcommand)]
|
||||
#[command(alias = "flags")]
|
||||
Flag(FlagSubcommand),
|
||||
|
||||
#[cfg(feature = "message-command")]
|
||||
#[cfg(feature = "message-subcmd")]
|
||||
#[command(subcommand)]
|
||||
#[command(alias = "messages", alias = "msgs", alias = "msg")]
|
||||
Message(MessageSubcommand),
|
||||
|
||||
#[cfg(feature = "attachment-command")]
|
||||
#[cfg(feature = "attachment-subcmd")]
|
||||
#[command(subcommand)]
|
||||
#[command(alias = "attachments")]
|
||||
Attachment(AttachmentSubcommand),
|
||||
|
||||
#[cfg(feature = "template-command")]
|
||||
#[cfg(feature = "template-subcmd")]
|
||||
#[command(subcommand)]
|
||||
#[command(alias = "templates", alias = "tpls", alias = "tpl")]
|
||||
Template(TemplateSubcommand),
|
||||
@@ -141,37 +141,37 @@ impl HimalayaCommand {
|
||||
config_path: Option<&PathBuf>,
|
||||
) -> Result<()> {
|
||||
match self {
|
||||
#[cfg(feature = "account-command")]
|
||||
#[cfg(feature = "account-subcmd")]
|
||||
Self::Account(cmd) => {
|
||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||
cmd.execute(printer, &config).await
|
||||
}
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
Self::Folder(cmd) => {
|
||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||
cmd.execute(printer, &config).await
|
||||
}
|
||||
#[cfg(feature = "envelope-command")]
|
||||
#[cfg(feature = "envelope-subcmd")]
|
||||
Self::Envelope(cmd) => {
|
||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||
cmd.execute(printer, &config).await
|
||||
}
|
||||
#[cfg(feature = "flag-command")]
|
||||
#[cfg(feature = "flag-subcmd")]
|
||||
Self::Flag(cmd) => {
|
||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||
cmd.execute(printer, &config).await
|
||||
}
|
||||
#[cfg(feature = "message-command")]
|
||||
#[cfg(feature = "message-subcmd")]
|
||||
Self::Message(cmd) => {
|
||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||
cmd.execute(printer, &config).await
|
||||
}
|
||||
#[cfg(feature = "attachment-command")]
|
||||
#[cfg(feature = "attachment-subcmd")]
|
||||
Self::Attachment(cmd) => {
|
||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||
cmd.execute(printer, &config).await
|
||||
}
|
||||
#[cfg(feature = "template-command")]
|
||||
#[cfg(feature = "template-subcmd")]
|
||||
Self::Template(cmd) => {
|
||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||
cmd.execute(printer, &config).await
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use clap::Parser;
|
||||
#[cfg(feature = "imap")]
|
||||
use email::message::add::imap::AddMessageImap;
|
||||
use email::message::add::imap::AddImapMessage;
|
||||
#[cfg(feature = "maildir")]
|
||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
||||
use email::message::add::maildir::AddMaildirMessage;
|
||||
#[cfg(feature = "sendmail")]
|
||||
use email::message::send::sendmail::SendMessageSendmail;
|
||||
#[cfg(feature = "smtp")]
|
||||
@@ -76,22 +76,20 @@ impl MessageForwardCommand {
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
builder
|
||||
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddMessageImap::new));
|
||||
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||
}
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(BackendKind::Maildir) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
ctx.maildir
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "sync")]
|
||||
Some(BackendKind::MaildirForSync) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir_for_sync
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
.and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
#[cfg(feature = "imap")]
|
||||
use email::message::add::imap::AddMessageImap;
|
||||
use email::message::add::imap::AddImapMessage;
|
||||
#[cfg(feature = "maildir")]
|
||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
||||
use email::message::add::maildir::AddMaildirMessage;
|
||||
#[cfg(feature = "sendmail")]
|
||||
use email::message::send::sendmail::SendMessageSendmail;
|
||||
#[cfg(feature = "smtp")]
|
||||
@@ -73,22 +73,20 @@ impl MessageMailtoCommand {
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
builder
|
||||
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddMessageImap::new));
|
||||
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||
}
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(BackendKind::Maildir) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
ctx.maildir
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "sync")]
|
||||
Some(BackendKind::MaildirForSync) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir_for_sync
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
.and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use clap::Parser;
|
||||
#[cfg(feature = "imap")]
|
||||
use email::message::add::imap::AddMessageImap;
|
||||
use email::message::add::imap::AddImapMessage;
|
||||
#[cfg(feature = "maildir")]
|
||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
||||
use email::message::add::maildir::AddMaildirMessage;
|
||||
#[cfg(feature = "sendmail")]
|
||||
use email::message::send::sendmail::SendMessageSendmail;
|
||||
#[cfg(feature = "smtp")]
|
||||
@@ -78,22 +78,20 @@ impl MessageReplyCommand {
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
builder
|
||||
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddMessageImap::new));
|
||||
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||
}
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(BackendKind::Maildir) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
ctx.maildir
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "sync")]
|
||||
Some(BackendKind::MaildirForSync) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir_for_sync
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
.and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
#[cfg(feature = "imap")]
|
||||
use email::message::add::imap::AddMessageImap;
|
||||
use email::message::add::imap::AddImapMessage;
|
||||
#[cfg(feature = "maildir")]
|
||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
||||
use email::message::add::maildir::AddMaildirMessage;
|
||||
use log::info;
|
||||
use std::io::{self, BufRead, IsTerminal};
|
||||
|
||||
@@ -59,22 +59,20 @@ impl MessageSaveCommand {
|
||||
|#[allow(unused)] builder| match add_message_kind {
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
builder.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddMessageImap::new));
|
||||
builder.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||
}
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(BackendKind::Maildir) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
ctx.maildir
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "sync")]
|
||||
Some(BackendKind::MaildirForSync) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir_for_sync
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
.and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
#[cfg(feature = "imap")]
|
||||
use email::message::add_with_flags::imap::AddMessageWithFlagsImap;
|
||||
use email::message::add::imap::AddImapMessage;
|
||||
#[cfg(feature = "maildir")]
|
||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
||||
use email::message::add::maildir::AddMaildirMessage;
|
||||
#[cfg(feature = "sendmail")]
|
||||
use email::message::send::sendmail::SendMessageSendmail;
|
||||
#[cfg(feature = "smtp")]
|
||||
@@ -66,24 +66,21 @@ impl MessageSendCommand {
|
||||
match add_message_kind {
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
ctx.imap.as_ref().and_then(AddMessageWithFlagsImap::new)
|
||||
});
|
||||
builder
|
||||
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||
}
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(BackendKind::Maildir) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
ctx.maildir
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "sync")]
|
||||
Some(BackendKind::MaildirForSync) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir_for_sync
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
.and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
#[cfg(feature = "imap")]
|
||||
use email::message::add::imap::AddMessageImap;
|
||||
use email::message::add::imap::AddImapMessage;
|
||||
#[cfg(feature = "maildir")]
|
||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
||||
use email::message::add::maildir::AddMaildirMessage;
|
||||
#[cfg(feature = "sendmail")]
|
||||
use email::message::send::sendmail::SendMessageSendmail;
|
||||
#[cfg(feature = "smtp")]
|
||||
@@ -67,22 +67,20 @@ impl MessageWriteCommand {
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
builder
|
||||
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddMessageImap::new));
|
||||
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||
}
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(BackendKind::Maildir) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
ctx.maildir
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "sync")]
|
||||
Some(BackendKind::MaildirForSync) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir_for_sync
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
.and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
#[cfg(feature = "imap")]
|
||||
use email::message::add::imap::AddMessageImap;
|
||||
use email::message::add::imap::AddImapMessage;
|
||||
#[cfg(feature = "maildir")]
|
||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
||||
use email::message::add::maildir::AddMaildirMessage;
|
||||
use log::info;
|
||||
use mml::MmlCompilerBuilder;
|
||||
use std::io::{self, BufRead, IsTerminal};
|
||||
@@ -63,22 +63,20 @@ impl TemplateSaveCommand {
|
||||
|#[allow(unused)] builder| match add_message_kind {
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
builder.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddMessageImap::new));
|
||||
builder.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||
}
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(BackendKind::Maildir) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
ctx.maildir
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "sync")]
|
||||
Some(BackendKind::MaildirForSync) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir_for_sync
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
.and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
#[cfg(feature = "imap")]
|
||||
use email::message::add_with_flags::imap::AddMessageWithFlagsImap;
|
||||
use email::message::add::imap::AddImapMessage;
|
||||
#[cfg(feature = "maildir")]
|
||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
||||
use email::message::add::maildir::AddMaildirMessage;
|
||||
#[cfg(feature = "sendmail")]
|
||||
use email::message::send::sendmail::SendMessageSendmail;
|
||||
#[cfg(feature = "smtp")]
|
||||
@@ -69,24 +69,21 @@ impl TemplateSendCommand {
|
||||
match add_message_kind {
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
ctx.imap.as_ref().and_then(AddMessageWithFlagsImap::new)
|
||||
});
|
||||
builder
|
||||
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||
}
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(BackendKind::Maildir) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
ctx.maildir
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "sync")]
|
||||
Some(BackendKind::MaildirForSync) => {
|
||||
builder.set_add_message_with_flags(|ctx| {
|
||||
builder.set_add_message(|ctx| {
|
||||
ctx.maildir_for_sync
|
||||
.as_ref()
|
||||
.and_then(AddMessageWithFlagsMaildir::new)
|
||||
.and_then(AddMaildirMessage::new)
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
|
||||
+12
-12
@@ -1,29 +1,29 @@
|
||||
pub mod arg;
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
pub mod command;
|
||||
pub mod config;
|
||||
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
use anyhow::Result;
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
use serde::Serialize;
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
use std::ops;
|
||||
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
use crate::{
|
||||
printer::{PrintTable, PrintTableOpts, WriteColor},
|
||||
ui::{Cell, Row, Table},
|
||||
};
|
||||
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
#[derive(Clone, Debug, Default, Serialize)]
|
||||
pub struct Folder {
|
||||
pub name: String,
|
||||
pub desc: String,
|
||||
}
|
||||
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
impl From<&email::folder::Folder> for Folder {
|
||||
fn from(folder: &email::folder::Folder) -> Self {
|
||||
Folder {
|
||||
@@ -33,7 +33,7 @@ impl From<&email::folder::Folder> for Folder {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
impl Table for Folder {
|
||||
fn head() -> Row {
|
||||
Row::new()
|
||||
@@ -48,11 +48,11 @@ impl Table for Folder {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
#[derive(Clone, Debug, Default, Serialize)]
|
||||
pub struct Folders(Vec<Folder>);
|
||||
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
impl ops::Deref for Folders {
|
||||
type Target = Vec<Folder>;
|
||||
|
||||
@@ -61,14 +61,14 @@ impl ops::Deref for Folders {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
impl From<email::folder::Folders> for Folders {
|
||||
fn from(folders: email::folder::Folders) -> Self {
|
||||
Folders(folders.iter().map(Folder::from).collect())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "folder-command")]
|
||||
#[cfg(feature = "folder-subcmd")]
|
||||
impl PrintTable for Folders {
|
||||
fn print_table(&self, writer: &mut dyn WriteColor, opts: PrintTableOpts) -> Result<()> {
|
||||
writeln!(writer)?;
|
||||
|
||||
Reference in New Issue
Block a user