Skip to content

Commit

Permalink
refactor backend system, remove accouts flattening
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Feb 21, 2024
1 parent 76ab833 commit 3e0cf0c
Show file tree
Hide file tree
Showing 59 changed files with 357 additions and 1,571 deletions.
15 changes: 11 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 9 additions & 66 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,14 @@ rustdoc-args = ["--cfg", "docsrs"]
# features documentation:
# https://pimalaya.org/himalaya/cli/latest/installation.html#cargo
default = [
"wizard",

"imap",
"maildir",
# "notmuch",
"smtp",
"sendmail",

"account",
"folder",
"envelope",
"flag",
"message",
"attachment",
"template",
"account-discovery",
"account-sync",

# "pgp-commands",
# "pgp-gpg",
Expand All @@ -46,60 +39,8 @@ notmuch = ["email-lib/notmuch"]
smtp = ["email-lib/smtp"]
sendmail = ["email-lib/sendmail"]

wizard = ["email-lib/account-discovery"]
account = ["account-configure", "account-list", "account-sync"]
account-subcmd = []
account-configure = ["account-subcmd"]
account-list = ["account-subcmd"]
account-sync = ["account-subcmd", "email-lib/account-sync"]

folder = ["folder-add", "folder-list", "folder-expunge", "folder-purge", "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-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-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-subcmd = []
message-add = ["email-lib/message-add"]
message-peek = ["email-lib/message-peek"]
message-get = ["email-lib/message-get"]
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-subcmd = []
attachment-download = ["attachment-subcmd", "message-read"]

template = ["template-write", "template-reply", "template-forward", "template-save", "template-send"]
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"]
account-discovery = ["email-lib/account-discovery"]
account-sync = ["email-lib/account-sync"]

pgp = []
pgp-commands = ["email-lib/pgp-commands", "mml-lib/pgp-commands", "pgp"]
Expand All @@ -120,8 +61,7 @@ clap_mangen = "0.2"
console = "0.15.2"
dialoguer = "0.10.2"
dirs = "4.0"
# email-lib = { version = "=0.21.0", default-features = false }
email-lib = { git = "https://git.sr.ht/~soywod/pimalaya", default-features = false }
email-lib = { version = "=0.21.0", default-features = false }
email_address = "0.2.4"
env_logger = "0.8"
erased-serde = "0.3"
Expand Down Expand Up @@ -156,4 +96,7 @@ version = "0.29"
features = ["bundled"]

[target.'cfg(not(windows))'.dependencies.coredump]
version = "0.1"
version = "0.1"

[patch.crates-io]
email-lib = { git = "https://git.sr.ht/~soywod/pimalaya" }
11 changes: 1 addition & 10 deletions src/account/command/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#[cfg(feature = "account-configure")]
mod configure;
#[cfg(feature = "account-list")]
mod list;
#[cfg(feature = "account-sync")]
mod sync;
Expand All @@ -10,12 +8,9 @@ use clap::Subcommand;

use crate::{config::TomlConfig, printer::Printer};

#[cfg(feature = "account-configure")]
use self::configure::AccountConfigureCommand;
#[cfg(feature = "account-list")]
use self::list::AccountListCommand;
#[cfg(feature = "account-sync")]
use self::sync::AccountSyncCommand;
use self::{configure::AccountConfigureCommand, list::AccountListCommand};

/// Manage accounts.
///
Expand All @@ -24,11 +19,9 @@ use self::sync::AccountSyncCommand;
/// file. This subcommand allows you to manage them.
#[derive(Debug, Subcommand)]
pub enum AccountSubcommand {
#[cfg(feature = "account-configure")]
#[command(alias = "cfg")]
Configure(AccountConfigureCommand),

#[cfg(feature = "account-list")]
#[command(alias = "lst")]
List(AccountListCommand),

Expand All @@ -41,9 +34,7 @@ impl AccountSubcommand {
#[allow(unused)]
pub async fn execute(self, printer: &mut impl Printer, config: &TomlConfig) -> Result<()> {
match self {
#[cfg(feature = "account-configure")]
Self::Configure(cmd) => cmd.execute(printer, config).await,
#[cfg(feature = "account-list")]
Self::List(cmd) => cmd.execute(printer, config).await,
#[cfg(feature = "account-sync")]
Self::Sync(cmd) => cmd.execute(printer, config).await,
Expand Down
Loading

0 comments on commit 3e0cf0c

Please sign in to comment.