prepare v0.8.0

This commit is contained in:
Clément DOUIN 2023-05-31 16:12:18 +02:00
parent 32b31db175
commit d557d9e1df
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
7 changed files with 68 additions and 121 deletions

View file

@ -14,12 +14,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added OAuth 2.0 support for IMAP and SMTP. - Added OAuth 2.0 support for IMAP and SMTP.
- Added passwords and OAuth 2.0 configuration via the wizard. - Added passwords and OAuth 2.0 configuration via the wizard.
- Added `email-sending-save-copy` option to control whenever a copy of any sent email should be saved in the `sent` folder defined in `folder-aliases`. - Added `email-sending-save-copy` option to control whenever a copy of any sent email should be saved in the `sent` folder defined in `folder-aliases`.
- Imported id mapper from the lib, which means that the id mapping is now done by the CLI.
- Added `BackendConfig` to `AccountConfig::backend` to match sender implementation.
- Added support for pipeline commands, which means commands can be either a single command (string) or piped commands (list of strings). It applies for:
- `email-writing-verify-cmd`
- `email-writing-decrypt-cmd`
- `email-writing-sign-cmd`
- `email-writing-encrypt-cmd`
### Changed ### Changed
- Changed the default TLS provider to `rustls`. You can still use `native-tls` with the cargo feature `native-tls`. - [**BREAKING**] Changed the default TLS provider to `rustls-tls`. You can still use `native-tls` with the cargo feature `native-tls`.
- Changed the way secrets are managed. A secret is a sensitive data like passwords or tokens. There is 3 possible ways to declare a secret in the config file: - Changed release archive extensions from `.tar.gz` to `.tgz`.
- `{ raw = <secret> }` for the raw secret (unsafe, not recommanded), - Moved `wizard` module into domains (config, account, backend…).
- [**BREAKING**] Changed the way secrets are managed. A secret is a sensitive data like passwords or tokens. There is 3 possible ways to declare a secret in the config file:
- `{ raw = <secret> }` for the raw secret as string (unsafe, not recommanded),
- `{ cmd = <secret-cmd> }` for command that exposes the secret, - `{ cmd = <secret-cmd> }` for command that exposes the secret,
- `{ keyring = <secret-entry> }` for entry in your system's global keyring that contains the secret. - `{ keyring = <secret-entry> }` for entry in your system's global keyring that contains the secret.
@ -33,6 +42,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `smtp-oauth2-access-token` - `smtp-oauth2-access-token`
- `smtp-oauth2-refresh-token` - `smtp-oauth2-refresh-token`
### Fixed
- Fixed Windows releases corrupted archives.
### Removed
- [**BREAKING**] Removed cargo feature `rustls-native-certs` (it has been merged with the `rustls-tls` feature).
- [**BREAKING**] Removed `-s|--sanitize` option. It is done by default now, except if the `-t|--mime-type html` is set.
## [0.7.3] - 2023-05-01 ## [0.7.3] - 2023-05-01
### Fixed ### Fixed
@ -45,62 +63,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Added `create` and `delete` folder commands [sourcehut#54]. - Added `create` and `delete` folder commands [sourcehut#54].
- Added generated completions and man pages to releases - Added generated completions and man pages to releases [sourcehut#43].
[sourcehut#43]. - Added new account config option `sync-folders-strategy` which allows to choose a folders synchronization strategy [sourcehut#59]:
- Added new account config option `sync-folders-strategy` which allows
to choose a folders synchronization strategy [sourcehut#59]:
- `sync-folders-strategy = "all"`: synchronize all existing folders - `sync-folders-strategy = "all"`: synchronize all existing folders for the current account
for the current account - `sync-folders-strategy.include = ["folder1", "folder2", …]`: synchronize only the given folders for the current account
- `sync-folders-strategy.include = ["folder1", "folder2", …]`: - `sync-folders-strategy.exclude = ["folder1", "folder2", …]`: synchronizes all folders except the given ones for the current account
synchronize only the given folders for the current account
- `sync-folders-strategy.exclude = ["folder1", "folder2", …]`:
synchronizes all folders except the given ones for the current
account
Also added new `account sync` arguments that override the account Also added new `account sync` arguments that override the account config option:
config option:
- `-A|--all-folders`: include all folders to the synchronization. - `-A|--all-folders`: include all folders to the synchronization.
- `-F|--include-folder`: include given folders to the - `-F|--include-folder`: include given folders to the synchronization. They can be repeated `-F folder1 folder2` or `-F folder1 -F folder2`.
synchronization. They can be repeated `-F folder1 folder2` or `-F - `-x|--exclude-folder`: exclude given folders from the synchronization. They can be repeated `-x folder1 folder2` or `-x folder1 -F folder2`.
folder1 -F folder2`.
- `-x|--exclude-folder`: exclude given folders from the
synchronization. They can be repeated `-x folder1 folder2` or `-x
folder1 -F folder2`.
- Added cargo features `native-tls` (default), `rustls-tls` and - Added cargo features `native-tls` (default), `rustls-tls` and `rustls-native-certs`.
`rustls-native-certs`.
### Changed ### Changed
- Made global options truly global, which means they can be used - Made global options truly global, which means they can be used everywhere (not only *before* commands but also *after*) [sourcehut#60].
everywhere (not only *before* commands but also *after*) - Replaced reply all `-a` argument with `-A` because it conflicted with the global option `-a|--account`.
[sourcehut#60].
- Replaced reply all `-a` argument with `-A` because it conflicted
with the global option `-a|--account`.
- Replaced `himalaya-lib` by `pimalaya-email`. - Replaced `himalaya-lib` by `pimalaya-email`.
- Renamed feature `vendored` to `native-tls-vendored`. - Renamed feature `vendored` to `native-tls-vendored`.
- Removed the `develop` branch, all the development is now done on the - Removed the `develop` branch, all the development is now done on the `master` branch.
`master` branch.
### Fixed ### Fixed
- Fixed config deserialization issue with `email-hooks` and - Fixed config deserialization issue with `email-hooks` and `email-reading-format`.
`email-reading-format`.
- Fixed flags case sensitivity. - Fixed flags case sensitivity.
## [0.7.1] - 2023-02-14 ## [0.7.1] - 2023-02-14
### Added ### Added
- Added command `folders expunge` that deletes all emails marked for - Added command `folders expunge` that deletes all emails marked for deletion.
deletion.
### Changed ### Changed
- Changed the location of the - Changed the location of the [documentation](https://pimalaya.org/himalaya/).
[documentation](https://pimalaya.org/himalaya/).
### Fixed ### Fixed
@ -108,31 +107,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed ### Removed
- Removed the `maildir-backend` cargo feature, it is now included by - Removed the `maildir-backend` cargo feature, it is now included by default.
default. - Removed issues section on GitHub, now issues need to be opened by sending an email at [~soywod/pimalaya@todo.sr.ht](mailto:~soywod/pimalaya@todo.sr.ht).
- Removed issues section on GitHub, now issues need to be opened by
sending an email at
[~soywod/pimalaya@todo.sr.ht](mailto:~soywod/pimalaya@todo.sr.ht).
## [0.7.0] - 2023-02-08 ## [0.7.0] - 2023-02-08
### Added ### Added
- Added offline support with the `account sync` command to synchronize - Added offline support with the `account sync` command to synchronize a backend to a local Maildir backend [#342].
a backend to a local Maildir backend [#342]. - Added the flag `--disable-cache` to not use the local Maildir backend.
- Added the flag `--disable-cache` to not use the local Maildir - Added the email composer (from its own [repository](https://git.sr.ht/~soywod/mime-msg-builder)) [#341].
backend.
- Added the email composer (from its own
[repository](https://git.sr.ht/~soywod/mime-msg-builder)) [#341].
- Added Musl builds to releases [#356]. - Added Musl builds to releases [#356].
- Added `himalaya man` command to generate man page [#419]. - Added `himalaya man` command to generate man page [#419].
### Changed ### Changed
- Made commands `read`, `attachments`, `flags`, `copy`, `move`, - Made commands `read`, `attachments`, `flags`, `copy`, `move`, `delete` accept multiple ids.
`delete` accept multiple ids. - Flipped arguments `ids` and `folder` for commands `copy` and `move` in order the folder not to be considered as an id.
- Flipped arguments `ids` and `folder` for commands `copy` and `move`
in order the folder not to be considered as an id.
### Fixed ### Fixed
@ -140,17 +131,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed ### Removed
- Removed the `-a|--attachment` argument from `write`, `reply` and - Removed the `-a|--attachment` argument from `write`, `reply` and `forward` commands. Instead you can attach documents directly from the template using the syntax `<#part filename=/path/to/you/document.ext>`.
`forward` commands. Instead you can attach documents directly from - Removed the `-e|--encrypt` flag from `write`, `reply` and `forward` commands. Instead you can encrypt and sign parts directly from the template using the syntax `<#part type=text/plain encrypt=command sign=command>Hello!<#/part>`.
the template using the syntax `<#part - Removed the `-l|--log-level` option, use instead the `RUST_LOG` environment variable (see the [wiki](https://github.com/soywod/himalaya/wiki/Tips:debug-and-logs))
filename=/path/to/you/document.ext>`.
- Removed the `-e|--encrypt` flag from `write`, `reply` and `forward`
commands. Instead you can encrypt and sign parts directly from the
template using the syntax `<#part type=text/plain encrypt=command
sign=command>Hello!<#/part>`.
- Removed the `-l|--log-level` option, use instead the `RUST_LOG`
environment variable (see the
[wiki](https://github.com/soywod/himalaya/wiki/Tips:debug-and-logs))
## [0.6.1] - 2022-10-12 ## [0.6.1] - 2022-10-12
@ -160,19 +143,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Changed the behaviour of the `-t|--mime-type` argument of the `read` - Changed the behaviour of the `-t|--mime-type` argument of the `read` command. It is less strict now: if no part is found for the given MIME type, it will fallback to the other one. For example, giving `-t html` will show in priority HTML parts, but if none of them are found it will show plain parts instead (and vice versa).
command. It is less strict now: if no part is found for the given - Sanitization is not done by default when using the `read` command, the flag `-s|--sanitize` needs to be explicitly provided.
MIME type, it will fallback to the other one. For example, giving
`-t html` will show in priority HTML parts, but if none of them are
found it will show plain parts instead (and vice versa).
- Sanitization is not done by default when using the `read` command,
the flag `-s|--sanitize` needs to be explicitly provided.
### Fixed ### Fixed
- Fixed empty text bodies when reading html part on plain text email - Fixed empty text bodies when reading html part on plain text email [#352].
[#352].
## [0.6.0] - 2022-10-10 ## [0.6.0] - 2022-10-10
@ -182,34 +158,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
The source code has been splitted into subrepositories: The source code has been splitted into subrepositories:
- The email logic has been extracted from the CLI and placed in a - The email logic has been extracted from the CLI and placed in a lib on [sourcehut](https://git.sr.ht/~soywod/himalaya-lib)
lib on [sourcehut](https://git.sr.ht/~soywod/himalaya-lib) - The vim plugin is now in a dedicated repository on [sourcehut](https://git.sr.ht/~soywod/himalaya-vim) as well
- The vim plugin is now in a dedicated repository on - This repository only contains the CLI source code (it was not possible to move it to sourcehut because of cross platform builds)
[sourcehut](https://git.sr.ht/~soywod/himalaya-vim) as well
- This repository only contains the CLI source code (it was not
possible to move it to sourcehut because of cross platform builds)
- [**BREAKING**] Renamed `-m|--mailbox` to `-f|--folder` - [**BREAKING**] Renamed `-m|--mailbox` to `-f|--folder`
- [**BREAKING**] Refactored config system [#344]. - [**BREAKING**] Refactored config system [#344].
The configuration has been rethought in order to be more intuitive The configuration has been rethought in order to be more intuitive and structured. Here are the breaking changes for the global config:
and structured. Here are the breaking changes for the global config:
- `name` becomes `display-name` and is not mandatory anymore - `name` becomes `display-name` and is not mandatory anymore
- `signature-delimiter` becomes `signature-delim` - `signature-delimiter` becomes `signature-delim`
- `default-page-size` has been moved to `folder-listing-page-size` - `default-page-size` has been moved to `folder-listing-page-size` and `email-listing-page-size`
and `email-listing-page-size` - `notify-cmd`, `notify-query` and `watch-cmds` have been removed from the global config (available in account config only)
- `notify-cmd`, `notify-query` and `watch-cmds` have been removed - `folder-aliases` has been added to the global config (previously known as `mailboxes` from the account config)
from the global config (available in account config only)
- `folder-aliases` has been added to the global config (previously
known as `mailboxes` from the account config)
- `email-reading-headers`, `email-reading-format`, - `email-reading-headers`, `email-reading-format`,
`email-reading-decrypt-cmd`, `email-writing-encrypt-cmd` and `email-reading-decrypt-cmd`, `email-writing-encrypt-cmd` and
`email-hooks` have been added `email-hooks` have been added
The account config inherits the same breaking changes from the The account config inherits the same breaking changes from the global config, plus:
global config, plus:
- `imap-*` requires `backend = "imap"` - `imap-*` requires `backend = "imap"`
- `maildir-*` requires `backend = "maildir"` - `maildir-*` requires `backend = "maildir"`
@ -227,8 +195,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Flag commands [#334] - Fixed flag commands [#334].
- Windows build [#346] - Fixed Windows build [#346].
## [0.5.9] - 2022-03-12 ## [0.5.9] - 2022-03-12

8
Cargo.lock generated
View file

@ -1104,7 +1104,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]] [[package]]
name = "himalaya" name = "himalaya"
version = "0.7.3" version = "0.8.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"atty", "atty",
@ -2067,8 +2067,8 @@ dependencies = [
[[package]] [[package]]
name = "pimalaya-email" name = "pimalaya-email"
version = "0.8.0" version = "0.9.0"
source = "git+https://git.sr.ht/~soywod/pimalaya#6767853528d75d8d0e6ff5e424dafea7351c3c94" source = "git+https://git.sr.ht/~soywod/pimalaya#5f5815a1544a49e24ef73cd7f37f763d1c98f70e"
dependencies = [ dependencies = [
"advisory-lock", "advisory-lock",
"ammonia", "ammonia",
@ -2111,7 +2111,7 @@ dependencies = [
[[package]] [[package]]
name = "pimalaya-email-tpl" name = "pimalaya-email-tpl"
version = "0.2.0" version = "0.2.0"
source = "git+https://git.sr.ht/~soywod/pimalaya#6767853528d75d8d0e6ff5e424dafea7351c3c94" source = "git+https://git.sr.ht/~soywod/pimalaya#5f5815a1544a49e24ef73cd7f37f763d1c98f70e"
dependencies = [ dependencies = [
"chumsky 0.9.0", "chumsky 0.9.0",
"log", "log",

View file

@ -1,7 +1,7 @@
[package] [package]
name = "himalaya" name = "himalaya"
description = "CLI to manage your emails." description = "CLI to manage your emails."
version = "0.7.3" version = "0.8.0"
authors = ["soywod <clement.douin@posteo.net>"] authors = ["soywod <clement.douin@posteo.net>"]
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"

View file

@ -27,7 +27,7 @@ pub struct PipelineDef(
#[serde(getter = "Deref::deref", serialize_with = "pipeline")] Vec<SingleCmd>, #[serde(getter = "Deref::deref", serialize_with = "pipeline")] Vec<SingleCmd>,
); );
// NOTE: did not find the way to only do with macros… // NOTE: did not find the way to do it with macros…
pub fn pipeline<S>(cmds: &Vec<SingleCmd>, s: S) -> Result<S::Ok, S::Error> pub fn pipeline<S>(cmds: &Vec<SingleCmd>, s: S) -> Result<S::Ok, S::Error>
where where
S: Serializer, S: Serializer,

View file

@ -18,7 +18,6 @@ const ARG_PAGE_SIZE: &str = "page-size";
const ARG_QUERY: &str = "query"; const ARG_QUERY: &str = "query";
const ARG_RAW: &str = "raw"; const ARG_RAW: &str = "raw";
const ARG_REPLY_ALL: &str = "reply-all"; const ARG_REPLY_ALL: &str = "reply-all";
const ARG_SANITIZE: &str = "sanitize";
const CMD_ATTACHMENTS: &str = "attachments"; const CMD_ATTACHMENTS: &str = "attachments";
const CMD_COPY: &str = "copy"; const CMD_COPY: &str = "copy";
const CMD_DELETE: &str = "delete"; const CMD_DELETE: &str = "delete";
@ -44,7 +43,6 @@ pub type PageSize = usize;
pub type Query = String; pub type Query = String;
pub type Raw = bool; pub type Raw = bool;
pub type RawEmail = String; pub type RawEmail = String;
pub type Sanitize = bool;
pub type TextMime<'a> = &'a str; pub type TextMime<'a> = &'a str;
/// Represents the email commands. /// Represents the email commands.
@ -57,7 +55,7 @@ pub enum Cmd<'a> {
Forward(Id<'a>, tpl::args::Headers<'a>, tpl::args::Body<'a>), Forward(Id<'a>, tpl::args::Headers<'a>, tpl::args::Body<'a>),
List(table::args::MaxTableWidth, Option<PageSize>, Page), List(table::args::MaxTableWidth, Option<PageSize>, Page),
Move(Ids<'a>, Folder<'a>), Move(Ids<'a>, Folder<'a>),
Read(Ids<'a>, TextMime<'a>, Sanitize, Raw, Headers<'a>), Read(Ids<'a>, TextMime<'a>, Raw, Headers<'a>),
Reply(Id<'a>, All, tpl::args::Headers<'a>, tpl::args::Body<'a>), Reply(Id<'a>, All, tpl::args::Headers<'a>, tpl::args::Body<'a>),
Save(RawEmail), Save(RawEmail),
Search(Query, table::args::MaxTableWidth, Option<PageSize>, Page), Search(Query, table::args::MaxTableWidth, Option<PageSize>, Page),
@ -104,10 +102,9 @@ pub fn matches<'a>(m: &'a ArgMatches) -> Result<Option<Cmd<'a>>> {
} else if let Some(m) = m.subcommand_matches(CMD_READ) { } else if let Some(m) = m.subcommand_matches(CMD_READ) {
let ids = parse_ids_arg(m); let ids = parse_ids_arg(m);
let mime = parse_mime_type_arg(m); let mime = parse_mime_type_arg(m);
let sanitize = parse_sanitize_flag(m);
let raw = parse_raw_flag(m); let raw = parse_raw_flag(m);
let headers = parse_headers_arg(m); let headers = parse_headers_arg(m);
Cmd::Read(ids, mime, sanitize, raw, headers) Cmd::Read(ids, mime, raw, headers)
} else if let Some(m) = m.subcommand_matches(CMD_REPLY) { } else if let Some(m) = m.subcommand_matches(CMD_REPLY) {
let id = parse_id_arg(m); let id = parse_id_arg(m);
let all = parse_reply_all_flag(m); let all = parse_reply_all_flag(m);
@ -188,7 +185,6 @@ pub fn subcmds() -> Vec<Command> {
Command::new(CMD_READ) Command::new(CMD_READ)
.about("Read text bodies of emails") .about("Read text bodies of emails")
.arg(mime_type_arg()) .arg(mime_type_arg())
.arg(sanitize_flag())
.arg(raw_flag()) .arg(raw_flag())
.arg(headers_arg()) .arg(headers_arg())
.arg(ids_arg()), .arg(ids_arg()),
@ -364,15 +360,6 @@ pub fn parse_headers_arg(m: &ArgMatches) -> Vec<&str> {
.collect::<Vec<_>>() .collect::<Vec<_>>()
} }
/// Represents the sanitize flag.
pub fn sanitize_flag() -> Arg {
Arg::new(ARG_SANITIZE)
.help("Sanitizes text bodies")
.long("sanitize")
.short('s')
.action(ArgAction::SetTrue)
}
/// Represents the raw flag. /// Represents the raw flag.
pub fn raw_flag() -> Arg { pub fn raw_flag() -> Arg {
Arg::new(ARG_RAW) Arg::new(ARG_RAW)
@ -382,11 +369,6 @@ pub fn raw_flag() -> Arg {
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
} }
/// Represents the sanitize flag parser.
pub fn parse_sanitize_flag(m: &ArgMatches) -> bool {
m.get_flag(ARG_SANITIZE)
}
/// Represents the raw flag parser. /// Represents the raw flag parser.
pub fn parse_raw_flag(m: &ArgMatches) -> bool { pub fn parse_raw_flag(m: &ArgMatches) -> bool {
m.get_flag(ARG_RAW) m.get_flag(ARG_RAW)

View file

@ -216,9 +216,7 @@ pub fn read<P: Printer>(
backend: &mut dyn Backend, backend: &mut dyn Backend,
folder: &str, folder: &str,
ids: Vec<&str>, ids: Vec<&str>,
// TODO: map this to ShowTextsStrategy
text_mime: &str, text_mime: &str,
_sanitize: bool,
raw: bool, raw: bool,
headers: Vec<&str>, headers: Vec<&str>,
) -> Result<()> { ) -> Result<()> {

View file

@ -283,7 +283,7 @@ fn main() -> Result<()> {
ids, ids,
); );
} }
Some(email::args::Cmd::Read(ids, text_mime, sanitize, raw, headers)) => { Some(email::args::Cmd::Read(ids, text_mime, raw, headers)) => {
let folder = account_config.folder_alias(folder.unwrap_or(DEFAULT_INBOX_FOLDER))?; let folder = account_config.folder_alias(folder.unwrap_or(DEFAULT_INBOX_FOLDER))?;
let mut backend = BackendBuilder::new() let mut backend = BackendBuilder::new()
.disable_cache(disable_cache) .disable_cache(disable_cache)
@ -297,7 +297,6 @@ fn main() -> Result<()> {
&folder, &folder,
ids, ids,
text_mime, text_mime,
sanitize,
raw, raw,
headers, headers,
); );