mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-25 04:20:22 +00:00
clean cargo features
This commit is contained in:
parent
819bdc84b3
commit
161f35d20e
15 changed files with 148 additions and 163 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -9,8 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Added
|
||||
|
||||
- Added cargo feature `sync`.
|
||||
- Added one cargo feature per backend feature:
|
||||
- TODO
|
||||
- `account` including `account-configure`, `account-list`, `sync` and the `account` subcommand
|
||||
- `folder` including `folder-add`, `folder-list`, `folder-expunge`, `folder-purge`, `folder-delete` and the `folder` subcommand
|
||||
- `envelope` including `envelope-list`, `envelope-watch`, `envelope-get` and the `envelope` subcommand
|
||||
- `flag` including `flag-add`, `flag-set`, `flag-remove` and the `flag` subcommand
|
||||
- `message` including `message-read`, `message-write`, `message-mailto`, `message-reply`, `message-forward`, `message-copy`, `message-move`, `message-delete`, `message-save`, `message-send` and the `message` subcommand
|
||||
- `attachment` including `attachment-download` and the `attachment` subcommand
|
||||
- `template` including `template-write`, `template-reply`, `template-forward`, `template-save`, `template-send` and the `template` subcommand
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -20,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- Fixed default command: running `himalaya` without argument lists envelopes, as it used to be in previous versions.
|
||||
- Fixed bug when listing envelopes with `backend = "imap"`, `sync.enable = true` and `envelope.watch.backend = "imap"` led to unwanted IMAP connection creation (which slowed down the listing).
|
||||
- Fixed builds related to enabled cargo features.
|
||||
|
||||
## [1.0.0-beta] - 2024-01-01
|
||||
|
||||
|
|
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -1216,8 +1216,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "email-lib"
|
||||
version = "0.19.6"
|
||||
source = "git+https://git.sr.ht/~soywod/pimalaya#2933075a179bfff3349987e9620185799eeba907"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3b77f4c2aee25fe234194b651bfadc3b5a3e3c817ca8ba1cd0044f1dd462723"
|
||||
dependencies = [
|
||||
"advisory-lock",
|
||||
"anyhow",
|
||||
|
|
67
Cargo.toml
67
Cargo.toml
|
@ -39,53 +39,53 @@ maildir = ["email-lib/maildir"]
|
|||
notmuch = ["email-lib/notmuch"]
|
||||
smtp = ["email-lib/smtp"]
|
||||
sendmail = ["email-lib/sendmail"]
|
||||
account = ["account-configure", "account-list"]
|
||||
account-command = []
|
||||
account-configure = ["account-command"]
|
||||
account-list = ["account-command"]
|
||||
account = ["account-configure", "account-list", "sync"]
|
||||
account-subcmd = []
|
||||
account-configure = ["account-subcmd"]
|
||||
account-list = ["account-subcmd"]
|
||||
sync = ["account-subcmd", "email-lib/sync"]
|
||||
folder = ["folder-add", "folder-list", "folder-expunge", "folder-purge", "folder-delete"]
|
||||
folder-command = []
|
||||
folder-add = ["folder-command", "email-lib/folder-add"]
|
||||
folder-list = ["folder-command", "email-lib/folder-list"]
|
||||
folder-expunge = ["folder-command", "email-lib/folder-expunge"]
|
||||
folder-purge = ["folder-command", "email-lib/folder-purge"]
|
||||
folder-delete = ["folder-command", "email-lib/folder-delete"]
|
||||
folder-subcmd = []
|
||||
folder-add = ["folder-subcmd", "email-lib/folder-add"]
|
||||
folder-list = ["folder-subcmd", "email-lib/folder-list"]
|
||||
folder-expunge = ["folder-subcmd", "email-lib/folder-expunge"]
|
||||
folder-purge = ["folder-subcmd", "email-lib/folder-purge"]
|
||||
folder-delete = ["folder-subcmd", "email-lib/folder-delete"]
|
||||
envelope = ["envelope-list", "envelope-watch", "envelope-get"]
|
||||
envelope-command = []
|
||||
envelope-list = ["envelope-command", "email-lib/envelope-list"]
|
||||
envelope-watch = ["envelope-command", "email-lib/envelope-watch"]
|
||||
envelope-get = ["envelope-command", "email-lib/envelope-get"]
|
||||
envelope-subcmd = []
|
||||
envelope-list = ["envelope-subcmd", "email-lib/envelope-list"]
|
||||
envelope-watch = ["envelope-subcmd", "email-lib/envelope-watch"]
|
||||
envelope-get = ["envelope-subcmd", "email-lib/envelope-get"]
|
||||
flag = ["flag-add", "flag-set", "flag-remove"]
|
||||
flag-command = []
|
||||
flag-add = ["flag-command", "email-lib/flag-add"]
|
||||
flag-set = ["flag-command", "email-lib/flag-set"]
|
||||
flag-remove = ["flag-command", "email-lib/flag-remove"]
|
||||
flag-subcmd = []
|
||||
flag-add = ["flag-subcmd", "email-lib/flag-add"]
|
||||
flag-set = ["flag-subcmd", "email-lib/flag-set"]
|
||||
flag-remove = ["flag-subcmd", "email-lib/flag-remove"]
|
||||
message = ["message-read", "message-write", "message-mailto", "message-reply", "message-forward", "message-save", "message-send", "message-copy", "message-move", "message-delete"]
|
||||
message-command = []
|
||||
message-subcmd = []
|
||||
message-add = ["email-lib/message-add"]
|
||||
message-peek = ["email-lib/message-peek"]
|
||||
message-get = ["email-lib/message-get"]
|
||||
message-copy = ["message-command", "email-lib/message-copy"]
|
||||
message-move = ["message-command", "email-lib/message-move"]
|
||||
message-delete = ["message-command", "email-lib/message-delete"]
|
||||
message-send = ["message-command", "email-lib/message-send"]
|
||||
message-copy = ["message-subcmd", "email-lib/message-copy"]
|
||||
message-move = ["message-subcmd", "email-lib/message-move"]
|
||||
message-delete = ["message-subcmd", "email-lib/message-delete"]
|
||||
message-read = ["message-add", "message-peek", "message-get"]
|
||||
message-write = ["message-add", "message-send"]
|
||||
message-mailto = ["message-add", "message-send"]
|
||||
message-reply = ["message-get", "message-add", "message-send"]
|
||||
message-forward = ["message-get", "message-add", "message-send"]
|
||||
message-save = ["message-add"]
|
||||
message-send = ["message-subcmd", "email-lib/message-send"]
|
||||
attachment = ["attachment-download"]
|
||||
attachment-command = []
|
||||
attachment-download = ["attachment-command", "message-read"]
|
||||
attachment-subcmd = []
|
||||
attachment-download = ["attachment-subcmd", "message-read"]
|
||||
template = ["template-write", "template-reply", "template-forward", "template-save", "template-send"]
|
||||
template-command = []
|
||||
template-write = ["template-command"]
|
||||
template-reply = ["template-command", "email-lib/message-get"]
|
||||
template-forward = ["template-command", "email-lib/message-get"]
|
||||
template-save = ["template-command", "email-lib/message-add"]
|
||||
template-send = ["template-command", "email-lib/message-send"]
|
||||
sync = ["account-command", "email-lib/sync"]
|
||||
template-subcmd = []
|
||||
template-write = ["template-subcmd"]
|
||||
template-reply = ["template-subcmd", "email-lib/message-get"]
|
||||
template-forward = ["template-subcmd", "email-lib/message-get"]
|
||||
template-save = ["template-subcmd", "email-lib/message-add"]
|
||||
template-send = ["template-subcmd", "email-lib/message-send"]
|
||||
pgp = []
|
||||
pgp-commands = ["email-lib/pgp-commands", "mml-lib/pgp-commands", "pgp"]
|
||||
pgp-gpg = ["email-lib/pgp-gpg", "mml-lib/pgp-gpg", "pgp"]
|
||||
|
@ -105,8 +105,7 @@ clap_mangen = "0.2"
|
|||
console = "0.15.2"
|
||||
dialoguer = "0.10.2"
|
||||
dirs = "4.0"
|
||||
# email-lib = { version = "=0.19.6", default-features = false }
|
||||
email-lib = { git = "https://git.sr.ht/~soywod/pimalaya", default-features = false }
|
||||
email-lib = { version = "=0.20.0", default-features = false }
|
||||
email_address = "0.2.4"
|
||||
env_logger = "0.8"
|
||||
erased-serde = "0.3"
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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")]
|
||||
|
|
42
src/cli.rs
42
src/cli.rs
|
@ -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)
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
|
|
|
@ -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)?;
|
||||
|
|
Loading…
Reference in a new issue