revert cargo workspace feature

This commit is contained in:
Clément DOUIN 2021-11-12 00:33:24 +01:00
parent 9b0a3fcba5
commit 08d31ef55c
No known key found for this signature in database
GPG key ID: 69C9B9CFFDEE2DEF
96 changed files with 145 additions and 441 deletions

4
.gitignore vendored
View file

@ -5,5 +5,5 @@
/result /result
/result-lib /result-lib
# Vim plugins doc tags file # Vim plugin doc tags file
/*/vim/doc/tags /vim/doc/tags

View file

@ -7,11 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Changed
- Make use of cargo workspace feature
- [**BREAKING**] Because of workspace feature, the vim plugin is now accessible at `/email-manager/vim` instead of `/vim`
### Fixed ### Fixed
- Blur in list msg screenshot [#181] - Blur in list msg screenshot [#181]

View file

@ -1,11 +1,35 @@
[workspace] [package]
members = [ name = "himalaya"
"email-manager", description = "Command-line interface for email management"
# "email-synchronizer", version = "0.5.1"
# "contact-manager", authors = ["soywod <clement.douin@posteo.net>"]
# "contact-synchronizer", edition = "2018"
# "calendar-manager",
# "calendar-synchronizer", [dependencies]
# "task-manager", ammonia = "3.1.2"
# "task-synchronizer", anyhow = "1.0.44"
] atty = "0.2.14"
chrono = "0.4.19"
clap = { version = "2.33.3", default-features = false, features = ["suggestions", "color"] }
env_logger = "0.8.3"
html-escape = "0.2.9"
imap = "3.0.0-alpha.4"
imap-proto = "0.14.3"
# This commit includes the de/serialization of the ContentType
# lettre = { version = "0.10.0-rc.1", features = ["serde"] }
lettre = { git = "https://github.com/TornaxO7/lettre/", branch = "master", features = ["serde"] }
log = "0.4.14"
mailparse = "0.13.6"
native-tls = "0.2"
regex = "1.5.4"
rfc2047-decoder = "0.1.2"
serde = { version = "1.0.118", features = ["derive"] }
serde_json = "1.0.61"
shellexpand = "2.1.0"
termcolor = "1.1"
terminal_size = "0.1.15"
toml = "0.5.8"
tree_magic = "0.2.3"
unicode-width = "0.1.7"
url = "2.2.2"
uuid = { version = "0.8", features = ["v4"] }

120
README.md
View file

@ -1,44 +1,84 @@
# :mage: Himalaya # 📫 Himalaya
[![gh-actions](https://github.com/soywod/himalaya/workflows/deployment/badge.svg)](https://github.com/soywod/himalaya/actions?query=workflow%3Adeployment)
[![gh-actions](https://github.com/soywod/himalaya/workflows/tests/badge.svg)](https://github.com/soywod/himalaya/actions?query=workflow%3Atests)
[![gh-actions](https://github.com/soywod/himalaya/workflows/nix-build/badge.svg)](https://github.com/soywod/himalaya/actions?query=workflow%3Anix-build)
[![Homebrew](https://img.shields.io/badge/dynamic/json.svg?url=https://formulae.brew.sh/api/formula/himalaya.json&query=$.versions.stable&label=homebrew)](https://formulae.brew.sh/formula/himalaya)
Himalaya is a suite of independent [Personal Information Command-line interface for email management
Management](https://en.wikipedia.org/wiki/Personal_information_manager)
command-line tools.
![image](https://user-images.githubusercontent.com/10437171/138774902-7b9de5a3-93eb-44b0-8cfb-6d2e11e3b1aa.png) *The project is under active development. Do not use in production before the
`v1.0.0` (see the [roadmap](https://github.com/soywod/himalaya/milestone/5)).*
![image](https://user-images.githubusercontent.com/10437171/115144003-8a1b4880-a04a-11eb-80d2-245027e28591.png)
## Motivation
Bringing emails to the terminal is a *pain*. First, because they are sensitive
data. Secondly, the existing TUIs ([Mutt](http://www.mutt.org/),
[NeoMutt](https://neomutt.org/), [Alpine](https://alpine.x10host.com/),
[aerc](https://aerc-mail.org/)…) are really hard to configure. They require time
and patience.
The aim of Himalaya is to extract the email logic into a simple (yet solid) CLI
API that can be used directly from the terminal, from scripts, from UIs…
Possibilities are endless!
## Installation
```sh
curl -sSL https://raw.githubusercontent.com/soywod/himalaya/master/install.sh | PREFIX=~/.local sh
```
*See the
[wiki](https://github.com/soywod/himalaya/wiki/Installation:from-binary) for
other installation methods.*
## Configuration
```toml
# ~/.config/himalaya/config.toml
name = "Your full name"
downloads-dir = "/abs/path/to/downloads"
signature = """
Cordialement,
Regards,
"""
[gmail]
default = true
email = "your.email@gmail.com"
imap-host = "imap.gmail.com"
imap-port = 993
imap-login = "your.email@gmail.com"
imap-passwd-cmd = "pass show gmail"
smtp-host = "smtp.gmail.com"
smtp-port = 465
smtp-login = "your.email@gmail.com"
smtp-passwd-cmd = "security find-internet-password -gs gmail -w"
```
*See the
[wiki](https://github.com/soywod/himalaya/wiki/Configuration:config-file) for
all the options.*
## Features ## Features
### :mailbox: [Email](https://github.com/soywod/himalaya/blob/set-up-multi-crate/email-manager/README.md) - Mailbox listing
- Email listing and filtering
- Email composition based on `$EDITOR`
- Email manipulation (copy/move/delete)
- Multi-accounting
- IDLE mode for real-time notifications
- Vim plugin
- Completions for bash/zsh/fish
- JSON output
- …
Himalaya proposes a command-line API to manage your emails (listing, searching, *See the [wiki](https://github.com/soywod/himalaya/wiki/Usage:msg:list) for all
reading, copying, moving, deleting…). It is also shipped with a [Vim the features.*
plugin](https://github.com/soywod/himalaya/blob/set-up-multi-crate/email-manager/vim/README.md).
A [TUI](https://github.com/soywod/himalaya/pull/155) and an [Emacs
plugin](https://github.com/soywod/himalaya/issues/142https://github.com/soywod/himalaya/issues/142)
are in progress by the community. A
[synchronizer](https://github.com/soywod/himalaya/blob/set-up-multi-crate/email-synchronizer/README.md)
should also come soon.
### :card_index: [Contact](https://github.com/soywod/himalaya/blob/set-up-multi-crate/contact-manager/README.md) (TODO)
Himalaya plans to propose a command-line API to manage your contacts through
the [CardDAV](https://en.wikipedia.org/wiki/CardDAV) protocol. It may come in
the future with a Vim plugin, an Emacs plugin, a TUI and a synchronizer.
### :date: [Calendar](https://github.com/soywod/himalaya/blob/set-up-multi-crate/calendar-manager/README.md) (TODO)
Himalaya plans to propose a command-line API to manage your calendar through
the [CalDAV](https://en.wikipedia.org/wiki/CalDAV) protocol. It may come in the
future with a Vim plugin, an Emacs plugin, a TUI and a synchronizer.
### :stopwatch: [Tasks](https://github.com/soywod/himalaya/blob/set-up-multi-crate/task-manager/README.md) (TODO)
Himalaya plans to propose a command-line API to manage your tasks and your time
through the [CalDAV](https://en.wikipedia.org/wiki/CalDAV) protocol. It may
come in the future with a Vim plugin, an Emacs plugin, a TUI and a
synchronizer. The tool already exists in [another
repository](https://github.com/soywod/unfog): it needs to be rewritten and
added to the Himalaya suite.
## Sponsoring ## Sponsoring
@ -47,3 +87,13 @@ added to the Himalaya suite.
[![ko-fi](https://img.shields.io/badge/-Ko--fi-ff5e5a?logo=Ko-fi&logoColor=ffffff)](https://ko-fi.com/soywod) [![ko-fi](https://img.shields.io/badge/-Ko--fi-ff5e5a?logo=Ko-fi&logoColor=ffffff)](https://ko-fi.com/soywod)
[![buy-me-a-coffee](https://img.shields.io/badge/-Buy%20Me%20a%20Coffee-ffdd00?logo=Buy%20Me%20A%20Coffee&logoColor=000000)](https://www.buymeacoffee.com/soywod) [![buy-me-a-coffee](https://img.shields.io/badge/-Buy%20Me%20a%20Coffee-ffdd00?logo=Buy%20Me%20A%20Coffee&logoColor=000000)](https://www.buymeacoffee.com/soywod)
[![liberapay](https://img.shields.io/badge/-Liberapay-f6c915?logo=Liberapay&logoColor=222222)](https://liberapay.com/soywod) [![liberapay](https://img.shields.io/badge/-Liberapay-f6c915?logo=Liberapay&logoColor=222222)](https://liberapay.com/soywod)
## Credits
- [IMAP RFC3501](https://tools.ietf.org/html/rfc3501)
- [Iris](https://github.com/soywod/iris.vim), the himalaya predecessor
- [isync](https://isync.sourceforge.io/), an email synchronizer for offline usage
- [NeoMutt](https://neomutt.org/), an email terminal user interface
- [Alpine](http://alpine.x10host.com/alpine/alpine-info/), an other email terminal user interface
- [mutt-wizard](https://github.com/LukeSmithxyz/mutt-wizard), a tool over NeoMutt and isync
- [rust-imap](https://github.com/jonhoo/rust-imap), a rust IMAP lib

View file

@ -3,9 +3,7 @@ Type=Application
Name=himalaya Name=himalaya
DesktopName=Himalaya DesktopName=Himalaya
GenericName=Mail Reader GenericName=Mail Reader
Comment=CLI email manager Comment=Command-line interface for email management
Comment[lo]=CLI Rust
Comment[th]=CLI Rust
Terminal=true Terminal=true
Exec=himalaya %U Exec=himalaya %U
Categories=Application;Network Categories=Application;Network

View file

@ -1,6 +0,0 @@
[package]
name = "makalu"
version = "0.1.0"
edition = "2018"
[dependencies]

View file

@ -1,3 +0,0 @@
# :date: Makalu
TODO

View file

@ -1,3 +0,0 @@
fn main() {
unimplemented!("The calendar manager is not implemented yet.");
}

View file

@ -1,6 +0,0 @@
[package]
name = "makalu-sync"
version = "0.1.0"
edition = "2018"
[dependencies]

View file

@ -1,3 +0,0 @@
# :date: :repeat: Makalu synchronizer
TODO

View file

@ -1,3 +0,0 @@
fn main() {
unimplemented!("The calendar synchronizer is not implemented yet.");
}

View file

@ -1,6 +0,0 @@
[package]
name = "everest"
version = "0.1.0"
edition = "2018"
[dependencies]

View file

@ -1,3 +0,0 @@
# :card_index: Everest
TODO

View file

@ -1,3 +0,0 @@
fn main() {
unimplemented!("The contact manager is not implemented yet.");
}

View file

@ -1,6 +0,0 @@
[package]
name = "everest-sync"
version = "0.1.0"
edition = "2018"
[dependencies]

View file

@ -1,3 +0,0 @@
# :card_index: :repeat: Everest synchronizer
TODO

View file

@ -1,3 +0,0 @@
fn main() {
unimplemented!("The contact synchronizer is not implemented yet.");
}

View file

@ -1,36 +0,0 @@
[package]
name = "himalaya"
description = "CLI email manager"
version = "0.5.1"
authors = ["soywod <clement.douin@posteo.net>"]
edition = "2018"
default-run = "himalaya"
[dependencies]
ammonia = "3.1.2"
anyhow = "1.0.44"
atty = "0.2.14"
chrono = "0.4.19"
clap = { version = "2.33.3", default-features = false, features = ["suggestions", "color"] }
env_logger = "0.8.3"
html-escape = "0.2.9"
imap = "3.0.0-alpha.4"
imap-proto = "0.14.3"
# This commit includes the de/serialization of the ContentType
# lettre = { version = "0.10.0-rc.1", features = ["serde"] }
lettre = { git = "https://github.com/TornaxO7/lettre/", branch = "master", features = ["serde"] }
log = "0.4.14"
mailparse = "0.13.6"
native-tls = "0.2"
regex = "1.5.4"
rfc2047-decoder = "0.1.2"
serde = { version = "1.0.118", features = ["derive"] }
serde_json = "1.0.61"
shellexpand = "2.1.0"
termcolor = "1.1"
terminal_size = "0.1.15"
toml = "0.5.8"
tree_magic = "0.2.3"
unicode-width = "0.1.7"
url = "2.2.2"
uuid = { version = "0.8", features = ["v4"] }

View file

@ -1,92 +0,0 @@
# :mailbox: Himalaya [![Homebrew](https://img.shields.io/badge/dynamic/json.svg?url=https://formulae.brew.sh/api/formula/himalaya.json&query=$.versions.stable&label=homebrew)](https://formulae.brew.sh/formula/himalaya)
![image](https://user-images.githubusercontent.com/10437171/138774902-7b9de5a3-93eb-44b0-8cfb-6d2e11e3b1aa.png)
## Motivation
Bringing emails to the terminal is a *pain*. First, because they are sensitive
data. Secondly, the existing TUIs ([Mutt](http://www.mutt.org/),
[NeoMutt](https://neomutt.org/), [Alpine](https://alpine.x10host.com/),
[aerc](https://aerc-mail.org/)…) are really hard to configure. They require time
and patience.
The aim of Himalaya is to extract the email logic into a simple (yet solid) CLI
API that can be used directly from the terminal, from scripts, from UIs…
Possibilities are endless!
## Installation
```sh
# As root:
curl -sSL https://raw.githubusercontent.com/soywod/himalaya/master/email-manager/install.sh | sudo sh
# As a regular user:
curl -sSL https://raw.githubusercontent.com/soywod/himalaya/master/email-manager/install.sh | PREFIX=~/.local sh
```
*See the [wiki](https://github.com/soywod/himalaya/wiki) for other installation
methods.*
## Configuration
```toml
# ~/.config/himalaya/config.toml
name = "Your full name"
downloads-dir = "/abs/path/to/downloads"
signature = """
--
Regards,
"""
[gmail]
default = true
email = "your.email@gmail.com"
imap-host = "imap.gmail.com"
imap-port = 993
imap-login = "your.email@gmail.com"
imap-passwd-cmd = "pass show gmail"
smtp-host = "smtp.gmail.com"
smtp-port = 465
smtp-login = "your.email@gmail.com"
smtp-passwd-cmd = "security find-internet-password -gs gmail -w"
```
*See the
[wiki](https://github.com/soywod/himalaya/wiki/Configuration:config-file) for
all the options.*
## Features
- Mailbox listing
- Email listing and filtering
- Email composition based on `$EDITOR`
- Email manipulation (copy/move/delete)
- Multi-accounting
- IDLE mode for real-time notifications
- Vim plugin
- Completions for bash/zsh/fish
- JSON output
- …
*See the [wiki](https://github.com/soywod/himalaya/wiki) for all the features.*
## Sponsoring
[![github](https://img.shields.io/badge/-GitHub%20Sponsors-fafbfc?logo=GitHub%20Sponsors)](https://github.com/sponsors/soywod)
[![paypal](https://img.shields.io/badge/-PayPal-0079c1?logo=PayPal&logoColor=ffffff)](https://www.paypal.com/paypalme/soywod)
[![ko-fi](https://img.shields.io/badge/-Ko--fi-ff5e5a?logo=Ko-fi&logoColor=ffffff)](https://ko-fi.com/soywod)
[![buy-me-a-coffee](https://img.shields.io/badge/-Buy%20Me%20a%20Coffee-ffdd00?logo=Buy%20Me%20A%20Coffee&logoColor=000000)](https://www.buymeacoffee.com/soywod)
[![liberapay](https://img.shields.io/badge/-Liberapay-f6c915?logo=Liberapay&logoColor=222222)](https://liberapay.com/soywod)
## Credits
- [IMAP RFC3501](https://tools.ietf.org/html/rfc3501)
- [Iris](https://github.com/soywod/iris.vim), the himalaya predecessor
- [isync](https://isync.sourceforge.io/), an email synchronizer for offline usage
- [NeoMutt](https://neomutt.org/), an email terminal user interface
- [Alpine](http://alpine.x10host.com/alpine/alpine-info/), an other email terminal user interface
- [mutt-wizard](https://github.com/LukeSmithxyz/mutt-wizard), a tool over NeoMutt and isync
- [rust-imap](https://github.com/jonhoo/rust-imap), a rust IMAP lib

View file

@ -1,150 +0,0 @@
// FIXME: fix tests
// use std::convert::TryFrom;
// use himalaya::{
// domain::account::entity::Account, flag::model::Flags, imap::model::ImapConnector,
// mbox::model::Mboxes, msg::model::Msgs,
// };
// use imap::types::Flag;
// use lettre::message::SinglePart;
// use lettre::Message;
// fn get_account(addr: &str) -> Account {
// Account {
// name: None,
// downloads_dir: None,
// signature_delimiter: None,
// signature: None,
// default_page_size: None,
// default: Some(true),
// email: addr.into(),
// watch_cmds: None,
// imap_host: String::from("localhost"),
// imap_port: 3993,
// imap_starttls: Some(false),
// imap_insecure: Some(true),
// imap_login: addr.into(),
// imap_passwd_cmd: String::from("echo 'password'"),
// smtp_host: String::from("localhost"),
// smtp_port: 3465,
// smtp_starttls: Some(false),
// smtp_insecure: Some(true),
// smtp_login: addr.into(),
// smtp_passwd_cmd: String::from("echo 'password'"),
// }
// }
// #[test]
// fn mbox() {
// let account = get_account("inbox@localhost");
// let mut imap_conn = ImapConnector::new(&account).unwrap();
// let names = imap_conn.list_mboxes().unwrap();
// let mboxes: Vec<String> = Mboxes::from(&names)
// .0
// .into_iter()
// .map(|mbox| mbox.name)
// .collect();
// assert_eq!(mboxes, vec![String::from("INBOX")]);
// imap_conn.logout();
// }
// #[test]
// fn msg() {
// // Preparations
// // Get the test-account and clean up the server.
// let account = get_account("inbox@localhost");
// // Login
// let mut imap_conn = ImapConnector::new(&account).unwrap();
// // remove all previous mails first
// let fetches = imap_conn.list_msgs("INBOX", &10, &0).unwrap();
// let msgs = if let Some(ref fetches) = fetches {
// Msgs::try_from(fetches).unwrap()
// } else {
// Msgs::new()
// };
// // mark all mails as deleted
// for msg in msgs.0.iter() {
// imap_conn
// .add_flags(
// "INBOX",
// &msg.get_uid().unwrap().to_string(),
// Flags::from(vec![Flag::Deleted]),
// )
// .unwrap();
// }
// imap_conn.expunge("INBOX").unwrap();
// // make sure, that they are *really* deleted
// assert!(imap_conn.list_msgs("INBOX", &10, &0).unwrap().is_none());
// // == Testing ==
// // Add messages
// let message_a = Message::builder()
// .from("sender-a@localhost".parse().unwrap())
// .to("inbox@localhost".parse().unwrap())
// .subject("Subject A")
// .singlepart(SinglePart::builder().body("Body A".as_bytes().to_vec()))
// .unwrap();
// let message_b = Message::builder()
// .from("Sender B <sender-b@localhost>".parse().unwrap())
// .to("inbox@localhost".parse().unwrap())
// .subject("Subject B")
// .singlepart(SinglePart::builder().body("Body B".as_bytes().to_vec()))
// .unwrap();
// smtp::send(&account, &message_a).unwrap();
// smtp::send(&account, &message_b).unwrap();
// // -- Get the messages --
// // TODO: check non-existance of \Seen flag
// let msgs = imap_conn.list_msgs("INBOX", &10, &0).unwrap();
// let msgs = if let Some(ref fetches) = msgs {
// Msgs::try_from(fetches).unwrap()
// } else {
// Msgs::new()
// };
// // make sure that there are both mails which we sended
// assert_eq!(msgs.0.len(), 2);
// let msg_a = msgs
// .0
// .iter()
// .find(|msg| msg.headers.subject.clone().unwrap() == "Subject A")
// .unwrap();
// let msg_b = msgs
// .0
// .iter()
// .find(|msg| msg.headers.subject.clone().unwrap() == "Subject B")
// .unwrap();
// // -- Checkup --
// // look, if we received the correct credentials of the msgs.
// assert_eq!(
// msg_a.headers.subject.clone().unwrap_or_default(),
// "Subject A"
// );
// assert_eq!(&msg_a.headers.from[0], "sender-a@localhost");
// assert_eq!(
// msg_b.headers.subject.clone().unwrap_or_default(),
// "Subject B"
// );
// assert_eq!(&msg_b.headers.from[0], "Sender B <sender-b@localhost>");
// // TODO: search messages
// // TODO: read message (+ \Seen flag)
// // TODO: list message attachments
// // TODO: add/set/remove flags
// // Logout
// imap_conn.logout();
// }

View file

@ -1,19 +0,0 @@
if exists("g:loaded_himalaya")
finish
endif
if !executable("himalaya")
throw "Himalaya CLI not found, see https://github.com/soywod/himalaya#installation"
endif
" Backup cpo
let s:cpo_backup = &cpo
set cpo&vim
command! -nargs=* Himalaya call himalaya#msg#list(<f-args>)
" Restore cpo
let &cpo = s:cpo_backup
unlet s:cpo_backup
let g:loaded_himalaya = 1

View file

@ -1,6 +0,0 @@
[package]
name = "himalaya-sync"
version = "0.1.0"
edition = "2018"
[dependencies]

View file

@ -1,3 +0,0 @@
# :mailbox: :repeat: Himalaya synchronizer
TODO

View file

@ -1,3 +0,0 @@
fn main() {
unimplemented!("The email synchronizer is not implemented yet.");
}

View file

@ -1,5 +1,5 @@
{ {
description = "CLI email manager"; description = "Command-line interface for email management";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

View file

@ -1,6 +0,0 @@
[package]
name = "lhotse"
version = "0.1.0"
edition = "2018"
[dependencies]

View file

@ -1,3 +0,0 @@
# :stopwatch: Lhotse
TODO

View file

@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}

View file

@ -1,6 +0,0 @@
[package]
name = "lhotse-sync"
version = "0.1.0"
edition = "2018"
[dependencies]

View file

@ -1,3 +0,0 @@
# :stopwatch: :repeat: Lhotse synchronizer
TODO

View file

@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}

View file

@ -8,7 +8,7 @@ this plugin with your favorite plugin manager. For example with
[vim-plug](https://github.com/junegunn/vim-plug), add to your `.vimrc`: [vim-plug](https://github.com/junegunn/vim-plug), add to your `.vimrc`:
```viml ```viml
Plug 'soywod/himalaya', {'rtp': 'email-manager/vim'} Plug 'soywod/himalaya', {'rtp': 'vim'}
``` ```
Then: Then:

View file

@ -1,4 +1,4 @@
*himalaya.txt* - CLI email manager *himalaya.txt* - Command-line interface for email management
_/ _/ _/_/_/ _/ _/ _/_/ _/ _/_/ _/ _/ _/_/ _/ _/ _/_/_/ _/ _/ _/_/ _/ _/_/ _/ _/ _/_/
_/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/

View file

@ -1 +1,19 @@
echoerr 'Cannot load himalaya: please change the rtp path from "vim" to "email-manager/vim" (https://github.com/soywod/himalaya/tree/development/email-manager/vim).' if exists("g:loaded_himalaya")
finish
endif
if !executable("himalaya")
throw "Himalaya CLI not found, see https://github.com/soywod/himalaya#installation"
endif
" Backup cpo
let s:cpo_backup = &cpo
set cpo&vim
command! -nargs=* Himalaya call himalaya#msg#list(<f-args>)
" Restore cpo
let &cpo = s:cpo_backup
unlet s:cpo_backup
let g:loaded_himalaya = 1