apply pr #461 due to conflicts, bump pimalaya crates

This commit is contained in:
Clément DOUIN 2023-12-10 22:01:49 +01:00
parent 203ed2f917
commit 8e05be7f77
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
10 changed files with 980 additions and 379 deletions

1129
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
[package]
name = "himalaya"
description = "CLI to manage emails."
version = "0.9.0"
description = "CLI to manage emails"
version = "1.0.0-beta"
authors = ["soywod <clement.douin@posteo.net>"]
edition = "2021"
license = "MIT"
@ -36,135 +36,45 @@ pgp-commands = ["pgp", "mml-lib/pgp-commands", "email-lib/pgp-commands"]
pgp-gpg = ["pgp", "mml-lib/pgp-gpg", "email-lib/pgp-gpg"]
pgp-native = ["pgp", "mml-lib/pgp-native", "email-lib/pgp-native"]
# dev dependencies
[dev-dependencies]
async-trait = "0.1"
tempfile = "3.3"
[dev-dependencies.async-trait]
version = "0.1"
[dev-dependencies.tempfile]
version = "3.3"
# dependencies
[dependencies.anyhow]
version = "1.0"
[dependencies.async-trait]
version = "0.1"
[dependencies.atty]
version = "0.2"
[dependencies.chrono]
version = "0.4.24"
[dependencies.clap]
version = "4.4"
features = ["derive", "wrap_help"]
[dependencies.clap_complete]
version = "4.4"
[dependencies.clap_mangen]
version = "0.2"
[dependencies.console]
version = "0.15.2"
[dependencies.dialoguer]
version = "0.10.2"
[dependencies.dirs]
version = "4.0.0"
[dependencies.email_address]
version = "0.2.4"
[dependencies.env_logger]
version = "0.10"
[dependencies.erased-serde]
version = "0.3"
[dependencies.indicatif]
version = "0.17"
[dependencies.log]
version = "0.4"
[dependencies.md5]
version = "0.7.0"
[dependencies.once_cell]
version = "1.16.0"
[dependencies.email-lib]
# version = "=0.15.3"
default-features = false
path = "/home/soywod/sourcehut/pimalaya/email"
[dependencies.keyring-lib]
# version = "=0.1.0"
path = "/home/soywod/sourcehut/pimalaya/keyring"
[dependencies.mail-builder]
version = "0.3"
[dependencies.oauth-lib]
# version = "=0.1.0"
path = "/home/soywod/sourcehut/pimalaya/oauth"
[dependencies.process-lib]
# version = "=0.1.0"
path = "/home/soywod/sourcehut/pimalaya/process"
[dependencies.mml-lib]
# version = "=1.0.1"
default-features = false
features = ["compiler", "interpreter"]
path = "/home/soywod/sourcehut/pimalaya/mml"
[dependencies.secret-lib]
# version = "=0.1.0"
path = "/home/soywod/sourcehut/pimalaya/secret"
[dependencies.serde]
version = "1.0"
features = ["derive"]
[dependencies.serde_json]
version = "1.0"
[dependencies.shellexpand-utils]
# version = "=0.1.0"
path = "/home/soywod/sourcehut/pimalaya/shellexpand-utils"
[dependencies.termcolor]
version = "1.1"
[dependencies.terminal_size]
version = "0.1"
[dependencies.tokio]
version = "1.23"
default-features = false
features = ["macros", "rt-multi-thread"]
[dependencies.toml]
version = "0.7.4"
[dependencies.toml_edit]
version = "0.19.8"
[dependencies.unicode-width]
version = "0.1"
[dependencies.url]
version = "2.2"
[dependencies.uuid]
version = "0.8"
features = ["v4"]
[dependencies]
anyhow = "1"
async-trait = "0.1"
chrono = "0.4.24"
clap = { version = "4.4", features = ["derive"] }
clap_complete = "4.4"
clap_mangen = "0.2"
console = "0.15.2"
dialoguer = "0.10.2"
dirs = "4.0"
email-lib = { version = "=0.16.0", default-features = false }
email_address = "0.2.4"
env_logger = "0.8"
erased-serde = "0.3"
indicatif = "0.17"
keyring-lib = "=0.2.0"
log = "0.4"
mail-builder = "0.3"
md5 = "0.7.0"
mml-lib = { version = "=1.0.2", default-features = false }
oauth-lib = "=0.1.0"
once_cell = "1.16"
process-lib = "=0.2.0"
secret-lib = "=0.2.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
shellexpand-utils = "=0.2.0"
termcolor = "1.1"
terminal_size = "0.1"
tokio = { version = "1.23", default-features = false, features = ["macros", "rt-multi-thread"] }
toml = "0.7.4"
toml_edit = "0.19.8"
unicode-width = "0.1"
url = "2.2"
uuid = { version = "0.8", features = ["v4"] }
[target.'cfg(target_env = "musl")'.dependencies.rusqlite]
version = "0.29"
@ -175,4 +85,4 @@ version = "0.29"
features = ["bundled"]
[target.'cfg(not(windows))'.dependencies.coredump]
version = "=0.1.2"
version = "=0.1.2"

View file

@ -1,11 +1,12 @@
use anyhow::{bail, Result};
use dialoguer::Input;
use dialoguer::{Confirm, Input};
use email_address::EmailAddress;
use crate::{
backend::{self, config::BackendConfig, BackendKind},
config::wizard::THEME,
message::config::{MessageConfig, MessageSendConfig},
wizard_prompt,
};
use super::TomlAccountConfig;
@ -35,6 +36,14 @@ pub(crate) async fn configure() -> Result<Option<(String, TomlAccountConfig)>> {
.interact()?,
);
config.downloads_dir = Some(
Input::with_theme(&*THEME)
.with_prompt("Downloads directory")
.default(String::from("~/Downloads"))
.interact()?
.into(),
);
match backend::wizard::configure(&account_name, &config.email).await? {
Some(BackendConfig::Maildir(mdir_config)) => {
config.maildir = Some(mdir_config);
@ -78,5 +87,15 @@ pub(crate) async fn configure() -> Result<Option<(String, TomlAccountConfig)>> {
_ => (),
};
config.sync = Some(
Confirm::new()
.with_prompt(wizard_prompt!(
"Do you need an offline access to your account?"
))
.default(false)
.interact_opt()?
.unwrap_or_default(),
);
Ok(Some((account_name, config)))
}

View file

@ -1,7 +1,7 @@
use anyhow::Result;
use dialoguer::{theme::ColorfulTheme, Confirm, Input, Password, Select};
use once_cell::sync::Lazy;
use shellexpand_utils::shellexpand_path;
use shellexpand_utils::expand;
use std::{fs, io, path::PathBuf, process};
use toml_edit::{Document, Item};
@ -94,7 +94,7 @@ pub(crate) async fn configure(path: PathBuf) -> Result<TomlConfig> {
))
.default(path.to_string_lossy().to_string())
.interact()?;
let path = shellexpand_path(&path);
let path = expand::path(&path);
println!("Writing the configuration to {path:?}");

View file

@ -1,7 +1,7 @@
use anyhow::{Context, Result};
use clap::Parser;
use log::info;
use std::fs;
use std::{fs, path::PathBuf};
use uuid::Uuid;
use crate::{
@ -67,6 +67,8 @@ impl AttachmentDownloadCommand {
for attachment in attachments {
let filename = attachment
.filename
.map(PathBuf::from)
.and_then(|f| f.file_name().map(|f| f.to_string_lossy().to_string()))
.unwrap_or_else(|| Uuid::new_v4().to_string());
let filepath = account_config.download_fpath(&filename)?;
printer.print_log(format!("Downloading {:?}", filepath))?;

View file

@ -1,8 +1,7 @@
use anyhow::Result;
use atty::Stream;
use clap::Parser;
use log::info;
use std::io::{self, BufRead};
use std::io::{self, BufRead, IsTerminal};
use crate::{
account::arg::name::AccountNameFlag, backend::Backend, cache::arg::disable::CacheDisableFlag,
@ -40,7 +39,7 @@ impl MessageSaveCommand {
config.clone().into_account_configs(account, cache)?;
let backend = Backend::new(toml_account_config, account_config.clone(), true).await?;
let is_tty = atty::is(Stream::Stdin);
let is_tty = io::stdin().is_terminal();
let is_json = printer.is_json();
let msg = if is_tty || is_json {
self.message.raw()

View file

@ -1,9 +1,8 @@
use anyhow::Result;
use atty::Stream;
use clap::Parser;
use email::flag::Flag;
use log::info;
use std::io::{self, BufRead};
use std::io::{self, BufRead, IsTerminal};
use crate::{
account::arg::name::AccountNameFlag, backend::Backend, cache::arg::disable::CacheDisableFlag,
@ -38,7 +37,7 @@ impl MessageSendCommand {
let backend = Backend::new(toml_account_config, account_config.clone(), true).await?;
let folder = account_config.sent_folder_alias()?;
let is_tty = atty::is(Stream::Stdin);
let is_tty = io::stdin().is_terminal();
let is_json = printer.is_json();
let msg = if is_tty || is_json {
self.message.raw()

View file

@ -1,9 +1,8 @@
use anyhow::Result;
use atty::Stream;
use clap::Parser;
use log::info;
use mml::MmlCompilerBuilder;
use std::io::{self, BufRead};
use std::io::{self, BufRead, IsTerminal};
use crate::{
account::arg::name::AccountNameFlag, backend::Backend, cache::arg::disable::CacheDisableFlag,
@ -44,7 +43,7 @@ impl TemplateSaveCommand {
config.clone().into_account_configs(account, cache)?;
let backend = Backend::new(toml_account_config, account_config.clone(), false).await?;
let is_tty = atty::is(Stream::Stdin);
let is_tty = io::stdin().is_terminal();
let is_json = printer.is_json();
let tpl = if is_tty || is_json {
self.template.raw()

View file

@ -1,10 +1,9 @@
use anyhow::Result;
use atty::Stream;
use clap::Parser;
use email::flag::Flag;
use log::info;
use mml::MmlCompilerBuilder;
use std::io::{self, BufRead};
use std::io::{self, BufRead, IsTerminal};
use crate::{
account::arg::name::AccountNameFlag, backend::Backend, cache::arg::disable::CacheDisableFlag,
@ -41,7 +40,7 @@ impl TemplateSendCommand {
let backend = Backend::new(toml_account_config, account_config.clone(), true).await?;
let folder = account_config.sent_folder_alias()?;
let is_tty = atty::is(Stream::Stdin);
let is_tty = io::stdin().is_terminal();
let is_json = printer.is_json();
let tpl = if is_tty || is_json {
self.template.raw()

View file

@ -1,8 +1,11 @@
use anyhow::{anyhow, Error, Result};
use atty::Stream;
use clap::ValueEnum;
use serde::Serialize;
use std::{fmt, str::FromStr};
use std::{
fmt,
io::{self, IsTerminal},
str::FromStr,
};
use termcolor::ColorChoice;
/// Represents the available output formats.
@ -78,7 +81,7 @@ impl From<ColorFmt> for ColorChoice {
ColorFmt::Always => Self::Always,
ColorFmt::Ansi => Self::AlwaysAnsi,
ColorFmt::Auto => {
if atty::is(Stream::Stdout) {
if io::stdout().is_terminal() {
// Otherwise let's `termcolor` decide by
// inspecting the environment. From the [doc]:
//