mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-20 07:28:26 +08:00
add one cargo feature per backend feature
This commit is contained in:
@@ -6,10 +6,13 @@ use email::folder::list::imap::ListFoldersImap;
|
||||
use email::folder::list::maildir::ListFoldersMaildir;
|
||||
use log::info;
|
||||
|
||||
#[cfg(any(feature = "imap", feature = "maildir", feature = "sync"))]
|
||||
use crate::backend::BackendKind;
|
||||
#[cfg(feature = "sync")]
|
||||
use crate::cache::arg::disable::CacheDisableFlag;
|
||||
use crate::{
|
||||
account::arg::name::AccountNameFlag,
|
||||
backend::{Backend, BackendKind},
|
||||
cache::arg::disable::CacheDisableFlag,
|
||||
backend::Backend,
|
||||
config::TomlConfig,
|
||||
folder::Folders,
|
||||
printer::{PrintTableOpts, Printer},
|
||||
@@ -24,6 +27,7 @@ pub struct FolderListCommand {
|
||||
#[command(flatten)]
|
||||
pub table: TableMaxWidthFlag,
|
||||
|
||||
#[cfg(feature = "sync")]
|
||||
#[command(flatten)]
|
||||
pub cache: CacheDisableFlag,
|
||||
|
||||
@@ -37,6 +41,7 @@ impl FolderListCommand {
|
||||
|
||||
let (toml_account_config, account_config) = config.clone().into_account_configs(
|
||||
self.account.name.as_ref().map(String::as_str),
|
||||
#[cfg(feature = "sync")]
|
||||
self.cache.disable,
|
||||
)?;
|
||||
|
||||
@@ -47,11 +52,18 @@ impl FolderListCommand {
|
||||
&account_config,
|
||||
list_folders_kind,
|
||||
|builder| match list_folders_kind {
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
builder
|
||||
.set_list_folders(|ctx| ctx.imap.as_ref().and_then(ListFoldersImap::new));
|
||||
}
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(BackendKind::Maildir) => {
|
||||
builder.set_list_folders(|ctx| {
|
||||
ctx.maildir.as_ref().and_then(ListFoldersMaildir::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "sync")]
|
||||
Some(BackendKind::MaildirForSync) => {
|
||||
builder.set_list_folders(|ctx| {
|
||||
ctx.maildir_for_sync
|
||||
@@ -59,11 +71,6 @@ impl FolderListCommand {
|
||||
.and_then(ListFoldersMaildir::new)
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "imap")]
|
||||
Some(BackendKind::Imap) => {
|
||||
builder
|
||||
.set_list_folders(|ctx| ctx.imap.as_ref().and_then(ListFoldersImap::new));
|
||||
}
|
||||
_ => (),
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user