fix missing notmuch backend features, improve docs

This commit is contained in:
Clément DOUIN 2024-01-22 10:39:06 +01:00
parent 8cebdf9e90
commit 4d288b9d51
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
13 changed files with 103 additions and 34 deletions

View file

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `attachment` including `attachment-download` and the `attachment` subcommand - `attachment` including `attachment-download` and the `attachment` subcommand
- `template` including `template-write`, `template-reply`, `template-forward`, `template-save`, `template-send` and the `template` subcommand - `template` including `template-write`, `template-reply`, `template-forward`, `template-save`, `template-send` and the `template` subcommand
- Added wizard capability to autodetect IMAP and SMTP configurations, based on the [Thunderbird Autoconfiguration](https://wiki.mozilla.org/Thunderbird:Autoconfiguration) standard. - Added wizard capability to autodetect IMAP and SMTP configurations, based on the [Thunderbird Autoconfiguration](https://wiki.mozilla.org/Thunderbird:Autoconfiguration) standard.
- Added back Notmuch backend features.
### Changed ### Changed

View file

@ -1,49 +1,31 @@
# Himalaya contributing guide # Contributing guide
Thank you for investing your time in contributing to Himalaya! Thank you for investing your time in contributing to Himalaya CLI!
## Development ## Development
The development environment is managed by The development environment is managed by [Nix](https://nixos.org/download.html). Running `nix-shell` will spawn a shell with everything you need to get started with the lib: `cargo`, `cargo-watch`, `rust-bin`, `rust-analyzer`, `notmuch`
[Nix](https://nixos.org/download.html). Running `nix-shell` will spawn
a shell with everything you need to get started with the tool:
`cargo`, `cargo-watch`, `rust-bin`, `rust-analyzer`
```sh ```sh
# starts a nix shell (the first launch may take a while) # Start a Nix shell
$ nix-shell $ nix-shell
# builds the CLI # then build the CLI
$ cargo build $ cargo build
# runs the CLI # run the CLI
$ cargo run -- list $ cargo run --feature pgp-gpg -- envelope list
``` ```
## Contributing ## Contributing
If you find a **bug**, please send an email at Himalaya CLI supports open-source, hence the choice of using [sourcehut](https://sourcehut.org/) for managing the project. The only reason why the source code is hosted on GitHub is to build releases for all major platforms (using GitHub Actions). Don't worry, contributing on sourcehut is not a big deal: you just need to send emails! You don't need to create any account. Here a small comparison guide with GitHub:
[~soywod/pimalaya@todo.sr.ht](mailto:~soywod/pimalaya@todo.sr.ht).
If you have a **question**, please send an email at The equivalent of **GitHub Discussions** are:
[~soywod/pimalaya@lists.sr.ht](mailto:~soywod/pimalaya@lists.sr.ht).
If you want to **propose a feature** or **fix a bug**, please send a - The [Matrix](https://matrix.org/) chat room [#pimalaya.himalaya](https://matrix.to/#/#pimalaya.himalaya:matrix.org)
patch at - The sourcehut mailing list. You can consult existing messages [here](https://lists.sr.ht/~soywod/pimalaya). You can "open a new discussion" by sending an email at [~soywod/pimalaya@lists.sr.ht](mailto:~soywod/pimalaya@lists.sr.ht). You can also [subscribe](mailto:~soywod/pimalaya+subscribe@lists.sr.ht) and [unsubscribe](mailto:~soywod/pimalaya+unsubscribe@lists.sr.ht) to the mailing list, so you can receive a copy of all discussions.
[~soywod/pimalaya@lists.sr.ht](mailto:~soywod/pimalaya@lists.sr.ht)
using [git send-email](https://git-scm.com/docs/git-send-email) (see
[this guide](https://git-send-email.io/) on how to configure it).
If you want to **subscribe** to the mailing list, please send an email The equivalent of **GitHub Issues** is the sourcehut bug tracker. You can consult existing bugs [here](https://todo.sr.ht/~soywod/pimalaya), and you can "open a new issue" by sending an email at [~soywod/pimalaya@todo.sr.ht](mailto:~soywod/pimalaya@todo.sr.ht).
at
[~soywod/pimalaya+subscribe@lists.sr.ht](mailto:~soywod/pimalaya+subscribe@lists.sr.ht).
If you want to **unsubscribe** to the mailing list, please send an The equivalent of **GitHub Pull requests** is the sourcehut mailing list. You can "open a new pull request" by sending an email containing a git patch at [~soywod/pimalaya@todo.sr.ht](mailto:~soywod/pimalaya@todo.sr.ht). The simplest way to send a patch is to use [git send-email](https://git-scm.com/docs/git-send-email), follow [this guide](https://git-send-email.io/) to configure git properly.
email at
[~soywod/pimalaya+unsubscribe@lists.sr.ht](mailto:~soywod/pimalaya+unsubscribe@lists.sr.ht).
If you want to **discuss** about the project, feel free to join the
[Matrix](https://matrix.org/) workspace
[#pimalaya.himalaya](https://matrix.to/#/#pimalaya.himalaya:matrix.org)
or contact me directly
[@soywod](https://matrix.to/#/@soywod:matrix.org).

View file

@ -71,15 +71,17 @@ Please read the [documentation](https://pimalaya.org/himalaya/cli/latest/configu
## Contributing ## Contributing
A **bug tracker** is available at <https://todo.sr.ht/~soywod/pimalaya>. Pleas read the [contributing guide](https://github.com/soywod/himalaya/blob/master/CONTRIBUTING.md) for more detailed information.
A **mailing list** is available at <https://lists.sr.ht/~soywod/pimalaya>. A **bug tracker** is available on [sourcehut](https://todo.sr.ht/~soywod/pimalaya) [[send an email](mailto:~soywod/pimalaya@todo.sr.ht)].
A **mailing list** is available on [sourcehut](https://lists.sr.ht/~soywod/pimalaya) [[send an email](mailto:~soywod/pimalaya@lists.sr.ht)|[subscribe](mailto:~soywod/pimalaya+subscribe@lists.sr.ht)|[unsubscribe](mailto:~soywod/pimalaya+unsubscribe@lists.sr.ht)].
If you want to **report a bug**, please send an email at [~soywod/pimalaya@todo.sr.ht](mailto:~soywod/pimalaya@todo.sr.ht). If you want to **report a bug**, please send an email at [~soywod/pimalaya@todo.sr.ht](mailto:~soywod/pimalaya@todo.sr.ht).
If you want to **propose a feature** or **fix a bug**, please send a patch at [~soywod/pimalaya@lists.sr.ht](mailto:~soywod/pimalaya@lists.sr.ht). The simplest way to send a patch is to use [git send-email](https://git-scm.com/docs/git-send-email), follow [this guide](https://git-send-email.io/) to configure git properly. If you want to **propose a feature** or **fix a bug**, please send a patch at [~soywod/pimalaya@lists.sr.ht](mailto:~soywod/pimalaya@lists.sr.ht). The simplest way to send a patch is to use [git send-email](https://git-scm.com/docs/git-send-email), follow [this guide](https://git-send-email.io/) to configure git properly.
If you just want to **discuss** about the project, feel free to join the [Matrix](https://matrix.org/) workspace [#pimalaya.himalaya](https://matrix.to/#/#pimalaya.himalaya:matrix.org) or contact me directly [@soywod](https://matrix.to/#/@soywod:matrix.org). You can also use the mailing list [[send an email](mailto:~soywod/pimalaya@lists.sr.ht)|[subscribe](mailto:~soywod/pimalaya+subscribe@lists.sr.ht)|[unsubscribe](mailto:~soywod/pimalaya+unsubscribe@lists.sr.ht)]. If you just want to **discuss** about the project, feel free to join the [Matrix](https://matrix.org/) workspace [#pimalaya.himalaya](https://matrix.to/#/#pimalaya.himalaya:matrix.org) or contact me directly [@soywod](https://matrix.to/#/@soywod:matrix.org). You can also use the mailing list.
## Sponsoring ## Sponsoring

View file

@ -4,6 +4,8 @@ use clap::Parser;
use email::message::copy::imap::CopyImapMessages; use email::message::copy::imap::CopyImapMessages;
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
use email::message::copy::maildir::CopyMaildirMessages; use email::message::copy::maildir::CopyMaildirMessages;
#[cfg(feature = "notmuch")]
use email::message::copy::notmuch::CopyNotmuchMessages;
use log::info; use log::info;
#[cfg(feature = "account-sync")] #[cfg(feature = "account-sync")]
@ -79,6 +81,12 @@ impl MessageCopyCommand {
.map(CopyMaildirMessages::new_boxed) .map(CopyMaildirMessages::new_boxed)
}); });
} }
#[cfg(feature = "notmuch")]
Some(BackendKind::Notmuch) => {
builder.set_copy_messages(|ctx| {
ctx.notmuch.as_ref().map(CopyNotmuchMessages::new_boxed)
});
}
_ => (), _ => (),
}, },
) )

View file

@ -4,6 +4,8 @@ use clap::Parser;
use email::{flag::add::imap::AddImapFlags, message::move_::imap::MoveImapMessages}; use email::{flag::add::imap::AddImapFlags, message::move_::imap::MoveImapMessages};
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
use email::{flag::add::maildir::AddMaildirFlags, message::move_::maildir::MoveMaildirMessages}; use email::{flag::add::maildir::AddMaildirFlags, message::move_::maildir::MoveMaildirMessages};
#[cfg(feature = "notmuch")]
use email::{flag::add::notmuch::AddNotmuchFlags, message::move_::notmuch::MoveNotmuchMessages};
use log::info; use log::info;
#[cfg(feature = "account-sync")] #[cfg(feature = "account-sync")]
@ -88,6 +90,14 @@ impl MessageDeleteCommand {
.map(AddMaildirFlags::new_boxed) .map(AddMaildirFlags::new_boxed)
}); });
} }
#[cfg(feature = "notmuch")]
Some(BackendKind::Notmuch) => {
builder.set_move_messages(|ctx| {
ctx.notmuch.as_ref().map(MoveNotmuchMessages::new_boxed)
});
builder
.set_add_flags(|ctx| ctx.notmuch.as_ref().map(AddNotmuchFlags::new_boxed));
}
_ => (), _ => (),
}, },
) )

View file

@ -4,6 +4,8 @@ use clap::Parser;
use email::message::add::imap::AddImapMessage; use email::message::add::imap::AddImapMessage;
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
use email::message::add::maildir::AddMaildirMessage; use email::message::add::maildir::AddMaildirMessage;
#[cfg(feature = "notmuch")]
use email::message::add::notmuch::AddNotmuchMessage;
#[cfg(feature = "sendmail")] #[cfg(feature = "sendmail")]
use email::message::send::sendmail::SendSendmailMessage; use email::message::send::sendmail::SendSendmailMessage;
#[cfg(feature = "smtp")] #[cfg(feature = "smtp")]
@ -93,6 +95,12 @@ impl MessageForwardCommand {
.map(AddMaildirMessage::new_boxed) .map(AddMaildirMessage::new_boxed)
}); });
} }
#[cfg(feature = "notmuch")]
Some(BackendKind::Notmuch) => {
builder.set_add_message(|ctx| {
ctx.notmuch.as_ref().map(AddNotmuchMessage::new_boxed)
});
}
_ => (), _ => (),
}; };

View file

@ -4,6 +4,8 @@ use clap::Parser;
use email::message::add::imap::AddImapMessage; use email::message::add::imap::AddImapMessage;
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
use email::message::add::maildir::AddMaildirMessage; use email::message::add::maildir::AddMaildirMessage;
#[cfg(feature = "notmuch")]
use email::message::add::notmuch::AddNotmuchMessage;
#[cfg(feature = "sendmail")] #[cfg(feature = "sendmail")]
use email::message::send::sendmail::SendSendmailMessage; use email::message::send::sendmail::SendSendmailMessage;
#[cfg(feature = "smtp")] #[cfg(feature = "smtp")]
@ -90,6 +92,12 @@ impl MessageMailtoCommand {
.map(AddMaildirMessage::new_boxed) .map(AddMaildirMessage::new_boxed)
}); });
} }
#[cfg(feature = "notmuch")]
Some(BackendKind::Notmuch) => {
builder.set_add_message(|ctx| {
ctx.notmuch.as_ref().map(AddNotmuchMessage::new_boxed)
});
}
_ => (), _ => (),
}; };

View file

@ -4,6 +4,8 @@ use clap::Parser;
use email::message::move_::imap::MoveImapMessages; use email::message::move_::imap::MoveImapMessages;
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
use email::message::move_::maildir::MoveMaildirMessages; use email::message::move_::maildir::MoveMaildirMessages;
#[cfg(feature = "notmuch")]
use email::message::move_::notmuch::MoveNotmuchMessages;
use log::info; use log::info;
#[cfg(feature = "account-sync")] #[cfg(feature = "account-sync")]
@ -79,6 +81,12 @@ impl MessageMoveCommand {
.map(MoveMaildirMessages::new_boxed) .map(MoveMaildirMessages::new_boxed)
}); });
} }
#[cfg(feature = "notmuch")]
Some(BackendKind::Notmuch) => {
builder.set_move_messages(|ctx| {
ctx.notmuch.as_ref().map(MoveNotmuchMessages::new_boxed)
});
}
_ => (), _ => (),
}, },
) )

View file

@ -4,6 +4,8 @@ use clap::Parser;
use email::message::{get::imap::GetImapMessages, peek::imap::PeekImapMessages}; use email::message::{get::imap::GetImapMessages, peek::imap::PeekImapMessages};
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
use email::{flag::add::maildir::AddMaildirFlags, message::peek::maildir::PeekMaildirMessages}; use email::{flag::add::maildir::AddMaildirFlags, message::peek::maildir::PeekMaildirMessages};
#[cfg(feature = "notmuch")]
use email::{flag::add::notmuch::AddNotmuchFlags, message::peek::notmuch::PeekNotmuchMessages};
use log::info; use log::info;
use mml::message::FilterParts; use mml::message::FilterParts;
@ -133,6 +135,14 @@ impl MessageReadCommand {
.map(AddMaildirFlags::new_boxed) .map(AddMaildirFlags::new_boxed)
}); });
} }
#[cfg(feature = "notmuch")]
Some(BackendKind::Notmuch) => {
builder.set_peek_messages(|ctx| {
ctx.notmuch.as_ref().map(PeekNotmuchMessages::new_boxed)
});
builder
.set_add_flags(|ctx| ctx.notmuch.as_ref().map(AddNotmuchFlags::new_boxed));
}
_ => (), _ => (),
}, },
) )

View file

@ -4,6 +4,8 @@ use clap::Parser;
use email::message::add::imap::AddImapMessage; use email::message::add::imap::AddImapMessage;
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
use email::message::add::maildir::AddMaildirMessage; use email::message::add::maildir::AddMaildirMessage;
#[cfg(feature = "notmuch")]
use email::message::add::notmuch::AddNotmuchMessage;
#[cfg(feature = "sendmail")] #[cfg(feature = "sendmail")]
use email::message::send::sendmail::SendSendmailMessage; use email::message::send::sendmail::SendSendmailMessage;
#[cfg(feature = "smtp")] #[cfg(feature = "smtp")]
@ -95,6 +97,12 @@ impl MessageReplyCommand {
.map(AddMaildirMessage::new_boxed) .map(AddMaildirMessage::new_boxed)
}); });
} }
#[cfg(feature = "notmuch")]
Some(BackendKind::Notmuch) => {
builder.set_add_message(|ctx| {
ctx.notmuch.as_ref().map(AddNotmuchMessage::new_boxed)
});
}
_ => (), _ => (),
}; };

View file

@ -4,6 +4,8 @@ use clap::Parser;
use email::message::add::imap::AddImapMessage; use email::message::add::imap::AddImapMessage;
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
use email::message::add::maildir::AddMaildirMessage; use email::message::add::maildir::AddMaildirMessage;
#[cfg(feature = "notmuch")]
use email::message::add::notmuch::AddNotmuchMessage;
use log::info; use log::info;
use std::io::{self, BufRead, IsTerminal}; use std::io::{self, BufRead, IsTerminal};
@ -75,6 +77,12 @@ impl MessageSaveCommand {
.map(AddMaildirMessage::new_boxed) .map(AddMaildirMessage::new_boxed)
}); });
} }
#[cfg(feature = "notmuch")]
Some(BackendKind::Notmuch) => {
builder.set_add_message(|ctx| {
ctx.notmuch.as_ref().map(AddNotmuchMessage::new_boxed)
});
}
_ => (), _ => (),
}, },
) )

View file

@ -4,6 +4,8 @@ use clap::Parser;
use email::message::add::imap::AddImapMessage; use email::message::add::imap::AddImapMessage;
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
use email::message::add::maildir::AddMaildirMessage; use email::message::add::maildir::AddMaildirMessage;
#[cfg(feature = "notmuch")]
use email::message::add::notmuch::AddNotmuchMessage;
#[cfg(feature = "sendmail")] #[cfg(feature = "sendmail")]
use email::message::send::sendmail::SendSendmailMessage; use email::message::send::sendmail::SendSendmailMessage;
#[cfg(feature = "smtp")] #[cfg(feature = "smtp")]
@ -84,6 +86,12 @@ impl MessageSendCommand {
.map(AddMaildirMessage::new_boxed) .map(AddMaildirMessage::new_boxed)
}); });
} }
#[cfg(feature = "notmuch")]
Some(BackendKind::Notmuch) => {
builder.set_add_message(|ctx| {
ctx.notmuch.as_ref().map(AddNotmuchMessage::new_boxed)
});
}
_ => (), _ => (),
}; };
match send_message_kind { match send_message_kind {

View file

@ -4,6 +4,8 @@ use clap::Parser;
use email::message::add::imap::AddImapMessage; use email::message::add::imap::AddImapMessage;
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
use email::message::add::maildir::AddMaildirMessage; use email::message::add::maildir::AddMaildirMessage;
#[cfg(feature = "notmuch")]
use email::message::add::notmuch::AddNotmuchMessage;
#[cfg(feature = "sendmail")] #[cfg(feature = "sendmail")]
use email::message::send::sendmail::SendSendmailMessage; use email::message::send::sendmail::SendSendmailMessage;
#[cfg(feature = "smtp")] #[cfg(feature = "smtp")]
@ -84,6 +86,12 @@ impl MessageWriteCommand {
.map(AddMaildirMessage::new_boxed) .map(AddMaildirMessage::new_boxed)
}); });
} }
#[cfg(feature = "notmuch")]
Some(BackendKind::Notmuch) => {
builder.set_add_message(|ctx| {
ctx.notmuch.as_ref().map(AddNotmuchMessage::new_boxed)
});
}
_ => (), _ => (),
}; };