replace himalaya-lib by pimalaya-email

This commit is contained in:
Clément DOUIN 2023-04-20 12:12:33 +02:00
parent 7b3a9e4cc7
commit 072f488d89
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
31 changed files with 128 additions and 124 deletions

View file

@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[sourcehut#60].
- Replaced reply all `-a` argument with `-A` because it conflicted
with the global option `-a|--account`.
- Replaced `himalaya-lib` by `pimalaya-email`.
### Fixed
@ -58,7 +59,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Changed the location of the
[documentation](https://pimalaya.org/himalaya/docs/).
[documentation](https://pimalaya.org/himalaya/).
### Fixed

82
Cargo.lock generated
View file

@ -785,10 +785,10 @@ dependencies = [
"email_address",
"env_logger",
"erased-serde",
"himalaya-lib",
"indicatif",
"log",
"once_cell",
"pimalaya-email",
"serde",
"serde_json",
"shellexpand",
@ -801,45 +801,6 @@ dependencies = [
"uuid",
]
[[package]]
name = "himalaya-lib"
version = "0.6.0"
source = "git+https://git.sr.ht/~soywod/himalaya-lib?branch=develop#7b8fb1d073b66d2f1d642df109c787ba3c31378f"
dependencies = [
"ammonia",
"chrono",
"convert_case",
"dirs",
"html-escape",
"imap",
"imap-proto",
"lettre",
"log",
"mail-parser",
"maildir",
"mailparse",
"md5",
"mime-msg-builder",
"native-tls",
"notmuch",
"once_cell",
"ouroboros",
"proc-lock",
"rayon",
"regex",
"rfc2047-decoder",
"rusqlite",
"rustls",
"rustls-native-certs",
"shellexpand",
"thiserror",
"tree_magic",
"urlencoding",
"utf7-imap",
"uuid",
"webpki-roots",
]
[[package]]
name = "hostname"
version = "0.3.1"
@ -1225,7 +1186,8 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
[[package]]
name = "mime-msg-builder"
version = "0.1.0"
source = "git+https://git.sr.ht/~soywod/mime-msg-builder?branch=develop#1f61083ba7811bf261647056e63441d2f997113c"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3981dce6db3e7f9faa1124409a6b94436902ecb2670f374d361789d61eb34ac"
dependencies = [
"ammonia",
"chumsky 0.9.0",
@ -1544,6 +1506,44 @@ dependencies = [
"siphasher",
]
[[package]]
name = "pimalaya-email"
version = "0.6.0"
dependencies = [
"ammonia",
"chrono",
"convert_case",
"dirs",
"html-escape",
"imap",
"imap-proto",
"lettre",
"log",
"mail-parser",
"maildir",
"mailparse",
"md5",
"mime-msg-builder",
"native-tls",
"notmuch",
"once_cell",
"ouroboros",
"proc-lock",
"rayon",
"regex",
"rfc2047-decoder",
"rusqlite",
"rustls",
"rustls-native-certs",
"shellexpand",
"thiserror",
"tree_magic",
"urlencoding",
"utf7-imap",
"uuid",
"webpki-roots",
]
[[package]]
name = "pin-project-lite"
version = "0.2.9"

View file

@ -1,14 +1,14 @@
[package]
name = "himalaya"
description = "Command-line interface for email management."
description = "CLI to manage your emails."
version = "0.7.1"
authors = ["soywod <clement.douin@posteo.net>"]
edition = "2021"
license = "MIT"
categories = ["command-line-interface", "command-line-utilities", "email"]
keywords = ["cli", "mail", "email", "client", "imap"]
homepage = "https://github.com/soywod/himalaya"
documentation = "https://github.com/soywod/himalaya/wiki"
homepage = "https://pimalaya.org/himalaya/"
documentation = "https://pimalaya.org/himalaya/"
repository = "https://github.com/soywod/himalaya"
[package.metadata.deb]
@ -19,19 +19,19 @@ section = "mail"
default = ["imap-backend", "smtp-sender", "native-tls"]
# backends
imap-backend = ["himalaya-lib/imap-backend"]
notmuch-backend = ["himalaya-lib/notmuch-backend"]
imap-backend = ["pimalaya-email/imap-backend"]
notmuch-backend = ["pimalaya-email/notmuch-backend"]
# senders
smtp-sender = ["himalaya-lib/smtp-sender"]
smtp-sender = ["pimalaya-email/smtp-sender"]
# native tls
native-tls = ["himalaya-lib/native-tls"]
native-tls-vendored = ["himalaya-lib/native-tls-vendored"]
native-tls = ["pimalaya-email/native-tls"]
native-tls-vendored = ["pimalaya-email/native-tls-vendored"]
# rustls
rustls-tls = ["himalaya-lib/rustls-tls"]
rustls-native-certs = ["himalaya-lib/rustls-native-certs"]
rustls-tls = ["pimalaya-email/rustls-tls"]
rustls-native-certs = ["pimalaya-email/rustls-native-certs"]
[dev-dependencies]
tempfile = "3.3"
@ -49,7 +49,8 @@ dialoguer = "0.10.2"
email_address = "0.2.4"
env_logger = "0.8"
erased-serde = "0.3"
himalaya-lib = { git = "https://git.sr.ht/~soywod/himalaya-lib", branch = "develop" }
# pimalaya-email = { git = "https://git.sr.ht/~soywod/pimalaya/email" }
pimalaya-email = { path = "/home/soywod/sourcehut/pimalaya/email" }
indicatif = "0.17"
log = "0.4"
once_cell = "1.16.0"

View file

@ -1,8 +1,9 @@
# 📫 Himalaya [![GitHub release](https://img.shields.io/github/v/release/soywod/himalaya?color=success)](https://github.com/soywod/himalaya/releases/latest) [![Matrix](https://img.shields.io/matrix/pimalaya.himalaya:matrix.org?color=success&label=chat)](https://matrix.to/#/#pimalaya.himalaya:matrix.org)
Himalaya is a CLI based on the
[himalaya-lib](https://git.sr.ht/~soywod/himalaya-lib) that allows you
to manipulate your emails using commands in your console.
https://pimalaya.org/himalaya/
CLI to manage your emails, based on the
[pimalaya-email](https://sr.ht/~soywod/pimalaya/) library.
![image](https://user-images.githubusercontent.com/10437171/138774902-7b9de5a3-93eb-44b0-8cfb-6d2e11e3b1aa.png)
@ -25,19 +26,19 @@ production before the `v1.0.0`.*
- JSON output
- …
[Folder listing]: https://pimalaya.org/himalaya/docs/cli/usage/folders/list.html
[Envelopes listing]: https://pimalaya.org/himalaya/docs/cli/usage/envelopes/list.html
[searching]: https://pimalaya.org/himalaya/docs/cli/usage/envelopes/search.html
[sorting]: https://pimalaya.org/himalaya/docs/cli/usage/envelopes/sort.html
[Email composition]: https://pimalaya.org/himalaya/docs/cli/usage/emails/write.html
[copy]: https://pimalaya.org/himalaya/docs/cli/usage/emails/copy.html
[move]: https://pimalaya.org/himalaya/docs/cli/usage/emails/move.html
[delete]: https://pimalaya.org/himalaya/docs/cli/usage/emails/delete.html
[Multi-accounting]: https://pimalaya.org/himalaya/docs/cli/configuration.html
[Account listing]: https://pimalaya.org/himalaya/docs/cli/usage/accounts/list.html
[Account synchronization]: https://pimalaya.org/himalaya/docs/cli/usage/accounts/synchronize.html
[real-time notifications]: https://pimalaya.org/himalaya/docs/cli/usage/notifications.html
[Completions]: https://pimalaya.org/himalaya/docs/cli/tips/completion.html
[Folder listing]: https://pimalaya.org/himalaya/cli/usage/folders/list.html
[Envelopes listing]: https://pimalaya.org/himalaya/cli/usage/envelopes/list.html
[searching]: https://pimalaya.org/himalaya/cli/usage/envelopes/search.html
[sorting]: https://pimalaya.org/himalaya/cli/usage/envelopes/sort.html
[Email composition]: https://pimalaya.org/himalaya/cli/usage/emails/write.html
[copy]: https://pimalaya.org/himalaya/cli/usage/emails/copy.html
[move]: https://pimalaya.org/himalaya/cli/usage/emails/move.html
[delete]: https://pimalaya.org/himalaya/cli/usage/emails/delete.html
[Multi-accounting]: https://pimalaya.org/himalaya/cli/configuration.html
[Account listing]: https://pimalaya.org/himalaya/cli/usage/accounts/list.html
[Account synchronization]: https://pimalaya.org/himalaya/cli/usage/accounts/synchronize.html
[real-time notifications]: https://pimalaya.org/himalaya/cli/usage/notifications.html
[Completions]: https://pimalaya.org/himalaya/cli/tips/completion.html
## Installation
@ -71,7 +72,7 @@ $ nix-env -i himalaya
```
*See the
[documentation](https://pimalaya.org/himalaya/docs/cli/installation.html)
[documentation](https://pimalaya.org/himalaya/cli/installation.html)
for other installation methods.*
</td>
@ -81,11 +82,12 @@ for other installation methods.*
## Configuration
Please read the
[documentation](https://pimalaya.org/himalaya/docs/cli/configuration.html).
[documentation](https://pimalaya.org/himalaya/cli/configuration.html).
## Contributing
If you find a **bug**, please send an email at
If you find a **bug** that [does not exist
yet](https://todo.sr.ht/~soywod/pimalaya), please send an email at
[~soywod/pimalaya@todo.sr.ht](mailto:~soywod/pimalaya@todo.sr.ht).
If you have a **question**, please send an email at

View file

@ -5,8 +5,8 @@
use anyhow::{anyhow, Context, Result};
use dirs::{config_dir, home_dir};
use himalaya_lib::{AccountConfig, BackendConfig, EmailHooks, EmailTextPlainFormat};
use log::{debug, trace};
use pimalaya_email::{AccountConfig, BackendConfig, EmailHooks, EmailTextPlainFormat};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, fs, path::PathBuf};
use toml;
@ -119,12 +119,12 @@ impl DeserializedConfig {
#[cfg(test)]
mod tests {
use himalaya_lib::{EmailSender, MaildirConfig, SendmailConfig, SmtpConfig};
use pimalaya_email::{EmailSender, MaildirConfig, SendmailConfig, SmtpConfig};
#[cfg(feature = "imap-backend")]
use himalaya_lib::ImapConfig;
use pimalaya_email::ImapConfig;
#[cfg(feature = "notmuch-backend")]
use himalaya_lib::NotmuchConfig;
use pimalaya_email::NotmuchConfig;
use std::io::Write;
use tempfile::NamedTempFile;

View file

@ -1,4 +1,4 @@
use himalaya_lib::{
use pimalaya_email::{
folder::sync::Strategy as SyncFoldersStrategy, EmailHooks, EmailSender, EmailTextPlainFormat,
MaildirConfig, SendmailConfig, SmtpConfig,
};
@ -6,10 +6,10 @@ use serde::{Deserialize, Serialize};
use std::{collections::HashSet, path::PathBuf};
#[cfg(feature = "imap-backend")]
use himalaya_lib::ImapConfig;
use pimalaya_email::ImapConfig;
#[cfg(feature = "notmuch-backend")]
use himalaya_lib::NotmuchConfig;
use pimalaya_email::NotmuchConfig;
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
#[serde(remote = "SmtpConfig")]

View file

@ -4,7 +4,7 @@ use crate::account::{
};
use anyhow::Result;
use dialoguer::{Input, Select};
use himalaya_lib::ImapConfig;
use pimalaya_email::ImapConfig;
#[cfg(feature = "imap-backend")]
pub(crate) fn configure(base: DeserializedBaseAccountConfig) -> Result<DeserializedAccountConfig> {

View file

@ -5,7 +5,7 @@ use crate::account::{
use anyhow::Result;
use dialoguer::Input;
use dirs::home_dir;
use himalaya_lib::MaildirConfig;
use pimalaya_email::MaildirConfig;
pub(crate) fn configure(base: DeserializedBaseAccountConfig) -> Result<DeserializedAccountConfig> {
let input = if let Some(home) = home_dir() {

View file

@ -4,7 +4,7 @@ use crate::account::{
};
use anyhow::Result;
use dialoguer::Input;
use himalaya_lib::{NotmuchBackend, NotmuchConfig};
use pimalaya_email::{NotmuchBackend, NotmuchConfig};
pub(crate) fn configure(base: DeserializedBaseAccountConfig) -> Result<DeserializedAccountConfig> {
let db_path = match NotmuchBackend::get_default_db_path() {

View file

@ -1,7 +1,7 @@
use super::THEME;
use anyhow::Result;
use dialoguer::Input;
use himalaya_lib::{EmailSender, SendmailConfig};
use pimalaya_email::{EmailSender, SendmailConfig};
pub(crate) fn configure() -> Result<EmailSender> {
Ok(EmailSender::Sendmail(SendmailConfig {

View file

@ -2,7 +2,7 @@ use super::{SECURITY_PROTOCOLS, THEME};
use crate::account::DeserializedBaseAccountConfig;
use anyhow::Result;
use dialoguer::{Input, Select};
use himalaya_lib::{EmailSender, SmtpConfig};
use pimalaya_email::{EmailSender, SmtpConfig};
pub(crate) fn configure(base: &DeserializedBaseAccountConfig) -> Result<EmailSender> {
let mut smtp_config = SmtpConfig {

View file

@ -2,8 +2,8 @@
use anyhow::Result;
use clap::{Arg, ArgAction, ArgMatches, Command};
use himalaya_lib::folder::sync::Strategy as SyncFoldersStrategy;
use log::info;
use pimalaya_email::folder::sync::Strategy as SyncFoldersStrategy;
use std::collections::HashSet;
use crate::{folder, ui::table};

View file

@ -3,7 +3,7 @@
//! This module contains the raw deserialized representation of an
//! account in the accounts section of the user configuration file.
use himalaya_lib::{
use pimalaya_email::{
folder::sync::Strategy as SyncFoldersStrategy, AccountConfig, BackendConfig, EmailHooks,
EmailSender, EmailTextPlainFormat, MaildirConfig,
};
@ -11,10 +11,10 @@ use serde::{Deserialize, Serialize};
use std::{collections::HashMap, path::PathBuf};
#[cfg(feature = "imap-backend")]
use himalaya_lib::ImapConfig;
use pimalaya_email::ImapConfig;
#[cfg(feature = "notmuch-backend")]
use himalaya_lib::NotmuchConfig;
use pimalaya_email::NotmuchConfig;
use crate::config::{prelude::*, DeserializedConfig};

View file

@ -3,12 +3,12 @@
//! This module gathers all account actions triggered by the CLI.
use anyhow::Result;
use himalaya_lib::{
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use log::{info, trace};
use pimalaya_email::{
folder::sync::Strategy as SyncFoldersStrategy, AccountConfig, Backend, BackendSyncBuilder,
BackendSyncProgressEvent,
};
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use log::{info, trace};
use crate::{
config::DeserializedConfig,
@ -226,7 +226,7 @@ pub fn sync<P: Printer>(
#[cfg(test)]
mod tests {
use himalaya_lib::{AccountConfig, ImapConfig};
use pimalaya_email::{AccountConfig, ImapConfig};
use std::{collections::HashMap, fmt::Debug, io};
use termcolor::ColorSpec;

View file

@ -1,9 +1,9 @@
use anyhow::{anyhow, Context, Result};
use atty::Stream;
use himalaya_lib::{
use log::{debug, trace};
use pimalaya_email::{
AccountConfig, Backend, Email, Flag, Flags, Sender, ShowTextPartsStrategy, Tpl, TplBuilder,
};
use log::{debug, trace};
use std::{
fs,
io::{self, BufRead},

View file

@ -26,8 +26,8 @@ pub struct Envelope {
pub date: DateTime<Local>,
}
impl From<&himalaya_lib::Envelope> for Envelope {
fn from(envelope: &himalaya_lib::Envelope) -> Self {
impl From<&pimalaya_email::Envelope> for Envelope {
fn from(envelope: &pimalaya_email::Envelope) -> Self {
Envelope {
id: envelope.id.clone(),
flags: envelope.flags.clone().into(),

View file

@ -21,8 +21,8 @@ impl ops::Deref for Envelopes {
}
}
impl From<himalaya_lib::Envelopes> for Envelopes {
fn from(envelopes: himalaya_lib::Envelopes) -> Self {
impl From<pimalaya_email::Envelopes> for Envelopes {
fn from(envelopes: pimalaya_email::Envelopes) -> Self {
Envelopes(envelopes.iter().map(Envelope::from).collect())
}
}

View file

@ -5,8 +5,8 @@
use anyhow::Result;
use clap::{Arg, ArgMatches, Command};
use himalaya_lib::{Flag, Flags};
use log::{debug, info};
use pimalaya_email::{Flag, Flags};
use crate::email;

View file

@ -11,15 +11,15 @@ pub enum Flag {
Custom(String),
}
impl From<&himalaya_lib::Flag> for Flag {
fn from(flag: &himalaya_lib::Flag) -> Self {
impl From<&pimalaya_email::Flag> for Flag {
fn from(flag: &pimalaya_email::Flag) -> Self {
match flag {
himalaya_lib::Flag::Seen => Flag::Seen,
himalaya_lib::Flag::Answered => Flag::Answered,
himalaya_lib::Flag::Flagged => Flag::Flagged,
himalaya_lib::Flag::Deleted => Flag::Deleted,
himalaya_lib::Flag::Draft => Flag::Draft,
himalaya_lib::Flag::Custom(flag) => Flag::Custom(flag.clone()),
pimalaya_email::Flag::Seen => Flag::Seen,
pimalaya_email::Flag::Answered => Flag::Answered,
pimalaya_email::Flag::Flagged => Flag::Flagged,
pimalaya_email::Flag::Deleted => Flag::Deleted,
pimalaya_email::Flag::Draft => Flag::Draft,
pimalaya_email::Flag::Custom(flag) => Flag::Custom(flag.clone()),
}
}
}

View file

@ -14,8 +14,8 @@ impl ops::Deref for Flags {
}
}
impl From<himalaya_lib::Flags> for Flags {
fn from(flags: himalaya_lib::Flags) -> Self {
impl From<pimalaya_email::Flags> for Flags {
fn from(flags: pimalaya_email::Flags) -> Self {
Flags(flags.iter().map(Flag::from).collect())
}
}

View file

@ -1,5 +1,5 @@
use anyhow::Result;
use himalaya_lib::{Backend, Flags};
use pimalaya_email::{Backend, Flags};
use crate::printer::Printer;

View file

@ -9,8 +9,8 @@ pub struct Folder {
pub desc: String,
}
impl From<&himalaya_lib::Folder> for Folder {
fn from(folder: &himalaya_lib::Folder) -> Self {
impl From<&pimalaya_email::Folder> for Folder {
fn from(folder: &pimalaya_email::Folder) -> Self {
Folder {
delim: folder.delim.clone(),
name: folder.name.clone(),

View file

@ -20,8 +20,8 @@ impl ops::Deref for Folders {
}
}
impl From<himalaya_lib::Folders> for Folders {
fn from(folders: himalaya_lib::Folders) -> Self {
impl From<pimalaya_email::Folders> for Folders {
fn from(folders: pimalaya_email::Folders) -> Self {
Folders(folders.iter().map(Folder::from).collect())
}
}

View file

@ -4,7 +4,7 @@
use anyhow::Result;
use dialoguer::Confirm;
use himalaya_lib::{AccountConfig, Backend};
use pimalaya_email::{AccountConfig, Backend};
use std::process;
use crate::{
@ -67,7 +67,7 @@ pub fn delete<P: Printer, B: Backend + ?Sized>(
#[cfg(test)]
mod tests {
use himalaya_lib::{
use pimalaya_email::{
backend, AccountConfig, Backend, Emails, Envelope, Envelopes, Flags, Folder, Folders,
};
use std::{any::Any, fmt::Debug, io};

View file

@ -3,7 +3,7 @@
//! This module gathers all IMAP handlers triggered by the CLI.
use anyhow::{Context, Result};
use himalaya_lib::ImapBackend;
use pimalaya_email::ImapBackend;
pub fn notify(imap: &ImapBackend, folder: &str, keepalive: u64) -> Result<()> {
imap.notify(keepalive, folder).context("cannot imap notify")

View file

@ -1,6 +1,6 @@
use anyhow::{anyhow, Result};
use atty::Stream;
use himalaya_lib::{AccountConfig, Backend, CompilerBuilder, Email, Flags, Sender, Tpl};
use pimalaya_email::{AccountConfig, Backend, CompilerBuilder, Email, Flags, Sender, Tpl};
use std::io::{stdin, BufRead};
use crate::printer::Printer;

View file

@ -10,7 +10,7 @@ use himalaya::{
printer::StdoutPrinter,
tpl,
};
use himalaya_lib::{
use pimalaya_email::{
BackendBuilder, BackendConfig, ImapBackend, SenderBuilder, DEFAULT_INBOX_FOLDER,
};

View file

@ -1,5 +1,5 @@
use anyhow::{Context, Result};
use himalaya_lib::Tpl;
use pimalaya_email::Tpl;
use crate::printer::WriteColor;

View file

@ -1,5 +1,5 @@
use anyhow::Result;
use himalaya_lib::EmailTextPlainFormat;
use pimalaya_email::EmailTextPlainFormat;
use std::io;
use termcolor::{self, StandardStream};

View file

@ -1,9 +1,9 @@
use anyhow::{Context, Result};
use himalaya_lib::{
use log::debug;
use pimalaya_email::{
email::{local_draft_path, remove_local_draft},
AccountConfig, Backend, CompilerBuilder, Flag, Flags, Sender, Tpl,
};
use log::debug;
use std::{env, fs, process::Command};
use crate::{

View file

@ -5,8 +5,8 @@
//! [builder design pattern]: https://refactoring.guru/design-patterns/builder
use anyhow::{Context, Result};
use himalaya_lib::EmailTextPlainFormat;
use log::trace;
use pimalaya_email::EmailTextPlainFormat;
use termcolor::{Color, ColorSpec};
use terminal_size;
use unicode_width::UnicodeWidthStr;