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
|
||||||
|
|
||||||
|
- Added cargo feature `sync`.
|
||||||
- Added one cargo feature per backend feature:
|
- 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
|
### 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 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 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
|
## [1.0.0-beta] - 2024-01-01
|
||||||
|
|
||||||
|
|
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -1216,8 +1216,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "email-lib"
|
name = "email-lib"
|
||||||
version = "0.19.6"
|
version = "0.20.0"
|
||||||
source = "git+https://git.sr.ht/~soywod/pimalaya#2933075a179bfff3349987e9620185799eeba907"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c3b77f4c2aee25fe234194b651bfadc3b5a3e3c817ca8ba1cd0044f1dd462723"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"advisory-lock",
|
"advisory-lock",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|
67
Cargo.toml
67
Cargo.toml
|
@ -39,53 +39,53 @@ maildir = ["email-lib/maildir"]
|
||||||
notmuch = ["email-lib/notmuch"]
|
notmuch = ["email-lib/notmuch"]
|
||||||
smtp = ["email-lib/smtp"]
|
smtp = ["email-lib/smtp"]
|
||||||
sendmail = ["email-lib/sendmail"]
|
sendmail = ["email-lib/sendmail"]
|
||||||
account = ["account-configure", "account-list"]
|
account = ["account-configure", "account-list", "sync"]
|
||||||
account-command = []
|
account-subcmd = []
|
||||||
account-configure = ["account-command"]
|
account-configure = ["account-subcmd"]
|
||||||
account-list = ["account-command"]
|
account-list = ["account-subcmd"]
|
||||||
|
sync = ["account-subcmd", "email-lib/sync"]
|
||||||
folder = ["folder-add", "folder-list", "folder-expunge", "folder-purge", "folder-delete"]
|
folder = ["folder-add", "folder-list", "folder-expunge", "folder-purge", "folder-delete"]
|
||||||
folder-command = []
|
folder-subcmd = []
|
||||||
folder-add = ["folder-command", "email-lib/folder-add"]
|
folder-add = ["folder-subcmd", "email-lib/folder-add"]
|
||||||
folder-list = ["folder-command", "email-lib/folder-list"]
|
folder-list = ["folder-subcmd", "email-lib/folder-list"]
|
||||||
folder-expunge = ["folder-command", "email-lib/folder-expunge"]
|
folder-expunge = ["folder-subcmd", "email-lib/folder-expunge"]
|
||||||
folder-purge = ["folder-command", "email-lib/folder-purge"]
|
folder-purge = ["folder-subcmd", "email-lib/folder-purge"]
|
||||||
folder-delete = ["folder-command", "email-lib/folder-delete"]
|
folder-delete = ["folder-subcmd", "email-lib/folder-delete"]
|
||||||
envelope = ["envelope-list", "envelope-watch", "envelope-get"]
|
envelope = ["envelope-list", "envelope-watch", "envelope-get"]
|
||||||
envelope-command = []
|
envelope-subcmd = []
|
||||||
envelope-list = ["envelope-command", "email-lib/envelope-list"]
|
envelope-list = ["envelope-subcmd", "email-lib/envelope-list"]
|
||||||
envelope-watch = ["envelope-command", "email-lib/envelope-watch"]
|
envelope-watch = ["envelope-subcmd", "email-lib/envelope-watch"]
|
||||||
envelope-get = ["envelope-command", "email-lib/envelope-get"]
|
envelope-get = ["envelope-subcmd", "email-lib/envelope-get"]
|
||||||
flag = ["flag-add", "flag-set", "flag-remove"]
|
flag = ["flag-add", "flag-set", "flag-remove"]
|
||||||
flag-command = []
|
flag-subcmd = []
|
||||||
flag-add = ["flag-command", "email-lib/flag-add"]
|
flag-add = ["flag-subcmd", "email-lib/flag-add"]
|
||||||
flag-set = ["flag-command", "email-lib/flag-set"]
|
flag-set = ["flag-subcmd", "email-lib/flag-set"]
|
||||||
flag-remove = ["flag-command", "email-lib/flag-remove"]
|
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 = ["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-add = ["email-lib/message-add"]
|
||||||
message-peek = ["email-lib/message-peek"]
|
message-peek = ["email-lib/message-peek"]
|
||||||
message-get = ["email-lib/message-get"]
|
message-get = ["email-lib/message-get"]
|
||||||
message-copy = ["message-command", "email-lib/message-copy"]
|
message-copy = ["message-subcmd", "email-lib/message-copy"]
|
||||||
message-move = ["message-command", "email-lib/message-move"]
|
message-move = ["message-subcmd", "email-lib/message-move"]
|
||||||
message-delete = ["message-command", "email-lib/message-delete"]
|
message-delete = ["message-subcmd", "email-lib/message-delete"]
|
||||||
message-send = ["message-command", "email-lib/message-send"]
|
|
||||||
message-read = ["message-add", "message-peek", "message-get"]
|
message-read = ["message-add", "message-peek", "message-get"]
|
||||||
message-write = ["message-add", "message-send"]
|
message-write = ["message-add", "message-send"]
|
||||||
message-mailto = ["message-add", "message-send"]
|
message-mailto = ["message-add", "message-send"]
|
||||||
message-reply = ["message-get", "message-add", "message-send"]
|
message-reply = ["message-get", "message-add", "message-send"]
|
||||||
message-forward = ["message-get", "message-add", "message-send"]
|
message-forward = ["message-get", "message-add", "message-send"]
|
||||||
message-save = ["message-add"]
|
message-save = ["message-add"]
|
||||||
|
message-send = ["message-subcmd", "email-lib/message-send"]
|
||||||
attachment = ["attachment-download"]
|
attachment = ["attachment-download"]
|
||||||
attachment-command = []
|
attachment-subcmd = []
|
||||||
attachment-download = ["attachment-command", "message-read"]
|
attachment-download = ["attachment-subcmd", "message-read"]
|
||||||
template = ["template-write", "template-reply", "template-forward", "template-save", "template-send"]
|
template = ["template-write", "template-reply", "template-forward", "template-save", "template-send"]
|
||||||
template-command = []
|
template-subcmd = []
|
||||||
template-write = ["template-command"]
|
template-write = ["template-subcmd"]
|
||||||
template-reply = ["template-command", "email-lib/message-get"]
|
template-reply = ["template-subcmd", "email-lib/message-get"]
|
||||||
template-forward = ["template-command", "email-lib/message-get"]
|
template-forward = ["template-subcmd", "email-lib/message-get"]
|
||||||
template-save = ["template-command", "email-lib/message-add"]
|
template-save = ["template-subcmd", "email-lib/message-add"]
|
||||||
template-send = ["template-command", "email-lib/message-send"]
|
template-send = ["template-subcmd", "email-lib/message-send"]
|
||||||
sync = ["account-command", "email-lib/sync"]
|
|
||||||
pgp = []
|
pgp = []
|
||||||
pgp-commands = ["email-lib/pgp-commands", "mml-lib/pgp-commands", "pgp"]
|
pgp-commands = ["email-lib/pgp-commands", "mml-lib/pgp-commands", "pgp"]
|
||||||
pgp-gpg = ["email-lib/pgp-gpg", "mml-lib/pgp-gpg", "pgp"]
|
pgp-gpg = ["email-lib/pgp-gpg", "mml-lib/pgp-gpg", "pgp"]
|
||||||
|
@ -105,8 +105,7 @@ clap_mangen = "0.2"
|
||||||
console = "0.15.2"
|
console = "0.15.2"
|
||||||
dialoguer = "0.10.2"
|
dialoguer = "0.10.2"
|
||||||
dirs = "4.0"
|
dirs = "4.0"
|
||||||
# email-lib = { version = "=0.19.6", default-features = false }
|
email-lib = { version = "=0.20.0", default-features = false }
|
||||||
email-lib = { git = "https://git.sr.ht/~soywod/pimalaya", default-features = false }
|
|
||||||
email_address = "0.2.4"
|
email_address = "0.2.4"
|
||||||
env_logger = "0.8"
|
env_logger = "0.8"
|
||||||
erased-serde = "0.3"
|
erased-serde = "0.3"
|
||||||
|
|
|
@ -231,17 +231,17 @@ impl TomlAccountConfig {
|
||||||
used_backends.extend(folder.get_used_backends());
|
used_backends.extend(folder.get_used_backends());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "envelope-command")]
|
#[cfg(feature = "envelope-subcmd")]
|
||||||
if let Some(ref envelope) = self.envelope {
|
if let Some(ref envelope) = self.envelope {
|
||||||
used_backends.extend(envelope.get_used_backends());
|
used_backends.extend(envelope.get_used_backends());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "flag-command")]
|
#[cfg(feature = "flag-subcmd")]
|
||||||
if let Some(ref flag) = self.flag {
|
if let Some(ref flag) = self.flag {
|
||||||
used_backends.extend(flag.get_used_backends());
|
used_backends.extend(flag.get_used_backends());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "message-command")]
|
#[cfg(feature = "message-subcmd")]
|
||||||
if let Some(ref msg) = self.message {
|
if let Some(ref msg) = self.message {
|
||||||
used_backends.extend(msg.get_used_backends());
|
used_backends.extend(msg.get_used_backends());
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,10 @@ use email::imap::{ImapSessionBuilder, ImapSessionSync};
|
||||||
use email::maildir::config::MaildirConfig;
|
use email::maildir::config::MaildirConfig;
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
use email::maildir::{MaildirSessionBuilder, MaildirSessionSync};
|
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"))]
|
#[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"))]
|
#[cfg(all(feature = "message-copy", feature = "imap"))]
|
||||||
use email::message::copy::imap::CopyMessagesImap;
|
use email::message::copy::imap::CopyMessagesImap;
|
||||||
#[cfg(all(feature = "message-copy", feature = "maildir"))]
|
#[cfg(all(feature = "message-copy", feature = "maildir"))]
|
||||||
|
@ -74,8 +76,6 @@ use email::message::peek::imap::PeekMessagesImap;
|
||||||
use email::message::peek::maildir::PeekMessagesMaildir;
|
use email::message::peek::maildir::PeekMessagesMaildir;
|
||||||
#[cfg(any(feature = "message-peek", feature = "message-get"))]
|
#[cfg(any(feature = "message-peek", feature = "message-get"))]
|
||||||
use email::message::Messages;
|
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")]
|
#[cfg(feature = "sendmail")]
|
||||||
use email::sendmail::SendmailContext;
|
use email::sendmail::SendmailContext;
|
||||||
#[cfg(feature = "smtp")]
|
#[cfg(feature = "smtp")]
|
||||||
|
@ -650,25 +650,20 @@ impl BackendBuilder {
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
Some(BackendKind::Imap) => {
|
Some(BackendKind::Imap) => {
|
||||||
backend_builder = backend_builder
|
backend_builder = backend_builder
|
||||||
.with_add_message(|ctx| ctx.imap.as_ref().and_then(AddMessageImap::new))
|
.with_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new))
|
||||||
.with_add_message_with_flags(|ctx| {
|
.with_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||||
ctx.imap.as_ref().and_then(AddMessageWithFlagsImap::new)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
Some(BackendKind::Maildir) => {
|
Some(BackendKind::Maildir) => {
|
||||||
backend_builder = backend_builder.with_add_message_with_flags(|ctx| {
|
backend_builder = backend_builder
|
||||||
ctx.maildir
|
.with_add_message(|ctx| ctx.maildir.as_ref().and_then(AddMaildirMessage::new));
|
||||||
.as_ref()
|
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
Some(BackendKind::MaildirForSync) => {
|
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
|
ctx.maildir_for_sync
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
.and_then(AddMaildirMessage::new)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(feature = "notmuch")]
|
#[cfg(feature = "notmuch")]
|
||||||
|
|
42
src/cli.rs
42
src/cli.rs
|
@ -2,19 +2,19 @@ use anyhow::Result;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[cfg(feature = "account-command")]
|
#[cfg(feature = "account-subcmd")]
|
||||||
use crate::account::command::AccountSubcommand;
|
use crate::account::command::AccountSubcommand;
|
||||||
#[cfg(feature = "envelope-command")]
|
#[cfg(feature = "envelope-subcmd")]
|
||||||
use crate::envelope::command::EnvelopeSubcommand;
|
use crate::envelope::command::EnvelopeSubcommand;
|
||||||
#[cfg(feature = "flag-command")]
|
#[cfg(feature = "flag-subcmd")]
|
||||||
use crate::flag::command::FlagSubcommand;
|
use crate::flag::command::FlagSubcommand;
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
use crate::folder::command::FolderSubcommand;
|
use crate::folder::command::FolderSubcommand;
|
||||||
#[cfg(feature = "attachment-command")]
|
#[cfg(feature = "attachment-subcmd")]
|
||||||
use crate::message::attachment::command::AttachmentSubcommand;
|
use crate::message::attachment::command::AttachmentSubcommand;
|
||||||
#[cfg(feature = "message-command")]
|
#[cfg(feature = "message-subcmd")]
|
||||||
use crate::message::command::MessageSubcommand;
|
use crate::message::command::MessageSubcommand;
|
||||||
#[cfg(feature = "template-command")]
|
#[cfg(feature = "template-subcmd")]
|
||||||
use crate::message::template::command::TemplateSubcommand;
|
use crate::message::template::command::TemplateSubcommand;
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -88,38 +88,38 @@ pub struct Cli {
|
||||||
|
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
pub enum HimalayaCommand {
|
pub enum HimalayaCommand {
|
||||||
#[cfg(feature = "account-command")]
|
#[cfg(feature = "account-subcmd")]
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
#[command(alias = "accounts")]
|
#[command(alias = "accounts")]
|
||||||
Account(AccountSubcommand),
|
Account(AccountSubcommand),
|
||||||
|
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
#[command(visible_alias = "mailbox", aliases = ["mailboxes", "mboxes", "mbox"])]
|
#[command(visible_alias = "mailbox", aliases = ["mailboxes", "mboxes", "mbox"])]
|
||||||
#[command(alias = "folders")]
|
#[command(alias = "folders")]
|
||||||
Folder(FolderSubcommand),
|
Folder(FolderSubcommand),
|
||||||
|
|
||||||
#[cfg(feature = "envelope-command")]
|
#[cfg(feature = "envelope-subcmd")]
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
#[command(alias = "envelopes")]
|
#[command(alias = "envelopes")]
|
||||||
Envelope(EnvelopeSubcommand),
|
Envelope(EnvelopeSubcommand),
|
||||||
|
|
||||||
#[cfg(feature = "flag-command")]
|
#[cfg(feature = "flag-subcmd")]
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
#[command(alias = "flags")]
|
#[command(alias = "flags")]
|
||||||
Flag(FlagSubcommand),
|
Flag(FlagSubcommand),
|
||||||
|
|
||||||
#[cfg(feature = "message-command")]
|
#[cfg(feature = "message-subcmd")]
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
#[command(alias = "messages", alias = "msgs", alias = "msg")]
|
#[command(alias = "messages", alias = "msgs", alias = "msg")]
|
||||||
Message(MessageSubcommand),
|
Message(MessageSubcommand),
|
||||||
|
|
||||||
#[cfg(feature = "attachment-command")]
|
#[cfg(feature = "attachment-subcmd")]
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
#[command(alias = "attachments")]
|
#[command(alias = "attachments")]
|
||||||
Attachment(AttachmentSubcommand),
|
Attachment(AttachmentSubcommand),
|
||||||
|
|
||||||
#[cfg(feature = "template-command")]
|
#[cfg(feature = "template-subcmd")]
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
#[command(alias = "templates", alias = "tpls", alias = "tpl")]
|
#[command(alias = "templates", alias = "tpls", alias = "tpl")]
|
||||||
Template(TemplateSubcommand),
|
Template(TemplateSubcommand),
|
||||||
|
@ -141,37 +141,37 @@ impl HimalayaCommand {
|
||||||
config_path: Option<&PathBuf>,
|
config_path: Option<&PathBuf>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
match self {
|
match self {
|
||||||
#[cfg(feature = "account-command")]
|
#[cfg(feature = "account-subcmd")]
|
||||||
Self::Account(cmd) => {
|
Self::Account(cmd) => {
|
||||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||||
cmd.execute(printer, &config).await
|
cmd.execute(printer, &config).await
|
||||||
}
|
}
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
Self::Folder(cmd) => {
|
Self::Folder(cmd) => {
|
||||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||||
cmd.execute(printer, &config).await
|
cmd.execute(printer, &config).await
|
||||||
}
|
}
|
||||||
#[cfg(feature = "envelope-command")]
|
#[cfg(feature = "envelope-subcmd")]
|
||||||
Self::Envelope(cmd) => {
|
Self::Envelope(cmd) => {
|
||||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||||
cmd.execute(printer, &config).await
|
cmd.execute(printer, &config).await
|
||||||
}
|
}
|
||||||
#[cfg(feature = "flag-command")]
|
#[cfg(feature = "flag-subcmd")]
|
||||||
Self::Flag(cmd) => {
|
Self::Flag(cmd) => {
|
||||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||||
cmd.execute(printer, &config).await
|
cmd.execute(printer, &config).await
|
||||||
}
|
}
|
||||||
#[cfg(feature = "message-command")]
|
#[cfg(feature = "message-subcmd")]
|
||||||
Self::Message(cmd) => {
|
Self::Message(cmd) => {
|
||||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||||
cmd.execute(printer, &config).await
|
cmd.execute(printer, &config).await
|
||||||
}
|
}
|
||||||
#[cfg(feature = "attachment-command")]
|
#[cfg(feature = "attachment-subcmd")]
|
||||||
Self::Attachment(cmd) => {
|
Self::Attachment(cmd) => {
|
||||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||||
cmd.execute(printer, &config).await
|
cmd.execute(printer, &config).await
|
||||||
}
|
}
|
||||||
#[cfg(feature = "template-command")]
|
#[cfg(feature = "template-subcmd")]
|
||||||
Self::Template(cmd) => {
|
Self::Template(cmd) => {
|
||||||
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
let config = TomlConfig::from_some_path_or_default(config_path).await?;
|
||||||
cmd.execute(printer, &config).await
|
cmd.execute(printer, &config).await
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
use email::message::add::imap::AddMessageImap;
|
use email::message::add::imap::AddImapMessage;
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
use email::message::add::maildir::AddMaildirMessage;
|
||||||
#[cfg(feature = "sendmail")]
|
#[cfg(feature = "sendmail")]
|
||||||
use email::message::send::sendmail::SendMessageSendmail;
|
use email::message::send::sendmail::SendMessageSendmail;
|
||||||
#[cfg(feature = "smtp")]
|
#[cfg(feature = "smtp")]
|
||||||
|
@ -76,22 +76,20 @@ impl MessageForwardCommand {
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
Some(BackendKind::Imap) => {
|
Some(BackendKind::Imap) => {
|
||||||
builder
|
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")]
|
#[cfg(feature = "maildir")]
|
||||||
Some(BackendKind::Maildir) => {
|
Some(BackendKind::Maildir) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir
|
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||||
.as_ref()
|
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
Some(BackendKind::MaildirForSync) => {
|
Some(BackendKind::MaildirForSync) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir_for_sync
|
ctx.maildir_for_sync
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
.and_then(AddMaildirMessage::new)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
use email::message::add::imap::AddMessageImap;
|
use email::message::add::imap::AddImapMessage;
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
use email::message::add::maildir::AddMaildirMessage;
|
||||||
#[cfg(feature = "sendmail")]
|
#[cfg(feature = "sendmail")]
|
||||||
use email::message::send::sendmail::SendMessageSendmail;
|
use email::message::send::sendmail::SendMessageSendmail;
|
||||||
#[cfg(feature = "smtp")]
|
#[cfg(feature = "smtp")]
|
||||||
|
@ -73,22 +73,20 @@ impl MessageMailtoCommand {
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
Some(BackendKind::Imap) => {
|
Some(BackendKind::Imap) => {
|
||||||
builder
|
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")]
|
#[cfg(feature = "maildir")]
|
||||||
Some(BackendKind::Maildir) => {
|
Some(BackendKind::Maildir) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir
|
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||||
.as_ref()
|
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
Some(BackendKind::MaildirForSync) => {
|
Some(BackendKind::MaildirForSync) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir_for_sync
|
ctx.maildir_for_sync
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
.and_then(AddMaildirMessage::new)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
use email::message::add::imap::AddMessageImap;
|
use email::message::add::imap::AddImapMessage;
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
use email::message::add::maildir::AddMaildirMessage;
|
||||||
#[cfg(feature = "sendmail")]
|
#[cfg(feature = "sendmail")]
|
||||||
use email::message::send::sendmail::SendMessageSendmail;
|
use email::message::send::sendmail::SendMessageSendmail;
|
||||||
#[cfg(feature = "smtp")]
|
#[cfg(feature = "smtp")]
|
||||||
|
@ -78,22 +78,20 @@ impl MessageReplyCommand {
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
Some(BackendKind::Imap) => {
|
Some(BackendKind::Imap) => {
|
||||||
builder
|
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")]
|
#[cfg(feature = "maildir")]
|
||||||
Some(BackendKind::Maildir) => {
|
Some(BackendKind::Maildir) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir
|
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||||
.as_ref()
|
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
Some(BackendKind::MaildirForSync) => {
|
Some(BackendKind::MaildirForSync) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir_for_sync
|
ctx.maildir_for_sync
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
.and_then(AddMaildirMessage::new)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
use email::message::add::imap::AddMessageImap;
|
use email::message::add::imap::AddImapMessage;
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
use email::message::add::maildir::AddMaildirMessage;
|
||||||
use log::info;
|
use log::info;
|
||||||
use std::io::{self, BufRead, IsTerminal};
|
use std::io::{self, BufRead, IsTerminal};
|
||||||
|
|
||||||
|
@ -59,22 +59,20 @@ impl MessageSaveCommand {
|
||||||
|#[allow(unused)] builder| match add_message_kind {
|
|#[allow(unused)] builder| match add_message_kind {
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
Some(BackendKind::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")]
|
#[cfg(feature = "maildir")]
|
||||||
Some(BackendKind::Maildir) => {
|
Some(BackendKind::Maildir) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir
|
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||||
.as_ref()
|
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
Some(BackendKind::MaildirForSync) => {
|
Some(BackendKind::MaildirForSync) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir_for_sync
|
ctx.maildir_for_sync
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
.and_then(AddMaildirMessage::new)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
use email::message::add_with_flags::imap::AddMessageWithFlagsImap;
|
use email::message::add::imap::AddImapMessage;
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
use email::message::add::maildir::AddMaildirMessage;
|
||||||
#[cfg(feature = "sendmail")]
|
#[cfg(feature = "sendmail")]
|
||||||
use email::message::send::sendmail::SendMessageSendmail;
|
use email::message::send::sendmail::SendMessageSendmail;
|
||||||
#[cfg(feature = "smtp")]
|
#[cfg(feature = "smtp")]
|
||||||
|
@ -66,24 +66,21 @@ impl MessageSendCommand {
|
||||||
match add_message_kind {
|
match add_message_kind {
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
Some(BackendKind::Imap) => {
|
Some(BackendKind::Imap) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder
|
||||||
ctx.imap.as_ref().and_then(AddMessageWithFlagsImap::new)
|
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
Some(BackendKind::Maildir) => {
|
Some(BackendKind::Maildir) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir
|
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||||
.as_ref()
|
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
Some(BackendKind::MaildirForSync) => {
|
Some(BackendKind::MaildirForSync) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir_for_sync
|
ctx.maildir_for_sync
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
.and_then(AddMaildirMessage::new)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
use email::message::add::imap::AddMessageImap;
|
use email::message::add::imap::AddImapMessage;
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
use email::message::add::maildir::AddMaildirMessage;
|
||||||
#[cfg(feature = "sendmail")]
|
#[cfg(feature = "sendmail")]
|
||||||
use email::message::send::sendmail::SendMessageSendmail;
|
use email::message::send::sendmail::SendMessageSendmail;
|
||||||
#[cfg(feature = "smtp")]
|
#[cfg(feature = "smtp")]
|
||||||
|
@ -67,22 +67,20 @@ impl MessageWriteCommand {
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
Some(BackendKind::Imap) => {
|
Some(BackendKind::Imap) => {
|
||||||
builder
|
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")]
|
#[cfg(feature = "maildir")]
|
||||||
Some(BackendKind::Maildir) => {
|
Some(BackendKind::Maildir) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir
|
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||||
.as_ref()
|
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
Some(BackendKind::MaildirForSync) => {
|
Some(BackendKind::MaildirForSync) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir_for_sync
|
ctx.maildir_for_sync
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
.and_then(AddMaildirMessage::new)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
use email::message::add::imap::AddMessageImap;
|
use email::message::add::imap::AddImapMessage;
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
use email::message::add::maildir::AddMaildirMessage;
|
||||||
use log::info;
|
use log::info;
|
||||||
use mml::MmlCompilerBuilder;
|
use mml::MmlCompilerBuilder;
|
||||||
use std::io::{self, BufRead, IsTerminal};
|
use std::io::{self, BufRead, IsTerminal};
|
||||||
|
@ -63,22 +63,20 @@ impl TemplateSaveCommand {
|
||||||
|#[allow(unused)] builder| match add_message_kind {
|
|#[allow(unused)] builder| match add_message_kind {
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
Some(BackendKind::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")]
|
#[cfg(feature = "maildir")]
|
||||||
Some(BackendKind::Maildir) => {
|
Some(BackendKind::Maildir) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir
|
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||||
.as_ref()
|
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
Some(BackendKind::MaildirForSync) => {
|
Some(BackendKind::MaildirForSync) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir_for_sync
|
ctx.maildir_for_sync
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
.and_then(AddMaildirMessage::new)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
use email::message::add_with_flags::imap::AddMessageWithFlagsImap;
|
use email::message::add::imap::AddImapMessage;
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
use email::message::add_with_flags::maildir::AddMessageWithFlagsMaildir;
|
use email::message::add::maildir::AddMaildirMessage;
|
||||||
#[cfg(feature = "sendmail")]
|
#[cfg(feature = "sendmail")]
|
||||||
use email::message::send::sendmail::SendMessageSendmail;
|
use email::message::send::sendmail::SendMessageSendmail;
|
||||||
#[cfg(feature = "smtp")]
|
#[cfg(feature = "smtp")]
|
||||||
|
@ -69,24 +69,21 @@ impl TemplateSendCommand {
|
||||||
match add_message_kind {
|
match add_message_kind {
|
||||||
#[cfg(feature = "imap")]
|
#[cfg(feature = "imap")]
|
||||||
Some(BackendKind::Imap) => {
|
Some(BackendKind::Imap) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder
|
||||||
ctx.imap.as_ref().and_then(AddMessageWithFlagsImap::new)
|
.set_add_message(|ctx| ctx.imap.as_ref().and_then(AddImapMessage::new));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
#[cfg(feature = "maildir")]
|
#[cfg(feature = "maildir")]
|
||||||
Some(BackendKind::Maildir) => {
|
Some(BackendKind::Maildir) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir
|
ctx.maildir.as_ref().and_then(AddMaildirMessage::new)
|
||||||
.as_ref()
|
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
Some(BackendKind::MaildirForSync) => {
|
Some(BackendKind::MaildirForSync) => {
|
||||||
builder.set_add_message_with_flags(|ctx| {
|
builder.set_add_message(|ctx| {
|
||||||
ctx.maildir_for_sync
|
ctx.maildir_for_sync
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(AddMessageWithFlagsMaildir::new)
|
.and_then(AddMaildirMessage::new)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
pub mod arg;
|
pub mod arg;
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
pub mod command;
|
pub mod command;
|
||||||
pub mod config;
|
pub mod config;
|
||||||
|
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
use std::ops;
|
use std::ops;
|
||||||
|
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
use crate::{
|
use crate::{
|
||||||
printer::{PrintTable, PrintTableOpts, WriteColor},
|
printer::{PrintTable, PrintTableOpts, WriteColor},
|
||||||
ui::{Cell, Row, Table},
|
ui::{Cell, Row, Table},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
#[derive(Clone, Debug, Default, Serialize)]
|
#[derive(Clone, Debug, Default, Serialize)]
|
||||||
pub struct Folder {
|
pub struct Folder {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub desc: String,
|
pub desc: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
impl From<&email::folder::Folder> for Folder {
|
impl From<&email::folder::Folder> for Folder {
|
||||||
fn from(folder: &email::folder::Folder) -> Self {
|
fn from(folder: &email::folder::Folder) -> Self {
|
||||||
Folder {
|
Folder {
|
||||||
|
@ -33,7 +33,7 @@ impl From<&email::folder::Folder> for Folder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
impl Table for Folder {
|
impl Table for Folder {
|
||||||
fn head() -> Row {
|
fn head() -> Row {
|
||||||
Row::new()
|
Row::new()
|
||||||
|
@ -48,11 +48,11 @@ impl Table for Folder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
#[derive(Clone, Debug, Default, Serialize)]
|
#[derive(Clone, Debug, Default, Serialize)]
|
||||||
pub struct Folders(Vec<Folder>);
|
pub struct Folders(Vec<Folder>);
|
||||||
|
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
impl ops::Deref for Folders {
|
impl ops::Deref for Folders {
|
||||||
type Target = Vec<Folder>;
|
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 {
|
impl From<email::folder::Folders> for Folders {
|
||||||
fn from(folders: email::folder::Folders) -> Self {
|
fn from(folders: email::folder::Folders) -> Self {
|
||||||
Folders(folders.iter().map(Folder::from).collect())
|
Folders(folders.iter().map(Folder::from).collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "folder-command")]
|
#[cfg(feature = "folder-subcmd")]
|
||||||
impl PrintTable for Folders {
|
impl PrintTable for Folders {
|
||||||
fn print_table(&self, writer: &mut dyn WriteColor, opts: PrintTableOpts) -> Result<()> {
|
fn print_table(&self, writer: &mut dyn WriteColor, opts: PrintTableOpts) -> Result<()> {
|
||||||
writeln!(writer)?;
|
writeln!(writer)?;
|
||||||
|
|
Loading…
Reference in a new issue