refactor: drop HIMALAYA_CONFIG support

Clap env vars are hard to customize across Pimalaya projects, and they can
always be replaced by arg or flag.
This commit is contained in:
Clément DOUIN
2026-06-01 17:20:57 +02:00
parent ec5a53233f
commit 07078437a2
44 changed files with 53 additions and 62 deletions
+2
View File
@@ -37,6 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed the `[message.composer.*]` and `[message.reader.*]` config tables together with the `messages compose-with`, `reply-with`, `forward-with`, `mailto` and `read-with` subcommands. The "stdout = MIME draft" contract was structurally incompatible with composers that spawn an interactive editor: the editor inherited the parent's piped stdout, breaking its UI. Richer composition is now wired through standalone tools chained into `messages send` / `messages add` via a tempfile or shell process substitution; see the README and [mml](https://github.com/pimalaya/mml).
- Dropped `HIMALAYA_CONFIG` environment-variable support on `-c/--config`. The flag still accepts one or more `:`-separated paths on the command line; users relying on the env var should switch to a shell alias or wrapper script.
## [1.2.0] - 2026-02-19
### Added
Generated
+5 -5
View File
@@ -1026,7 +1026,7 @@ dependencies = [
[[package]]
name = "imap-codec"
version = "2.0.0-alpha.7"
source = "git+https://github.com/soywod/imap-codec#dfd4f1f179defb6b479da3a95ed603170f0174ad"
source = "git+https://github.com/soywod/imap-codec#f1c29c7b5368063922778afdbcaefa18ed497a5e"
dependencies = [
"abnf-core",
"base64",
@@ -1039,7 +1039,7 @@ dependencies = [
[[package]]
name = "imap-types"
version = "2.0.0-alpha.6"
source = "git+https://github.com/soywod/imap-codec#dfd4f1f179defb6b479da3a95ed603170f0174ad"
source = "git+https://github.com/soywod/imap-codec#f1c29c7b5368063922778afdbcaefa18ed497a5e"
dependencies = [
"base64",
"bounded-static",
@@ -1664,7 +1664,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "pimalaya-cli"
version = "0.0.1"
source = "git+https://github.com/pimalaya/cli#8ee488f8701b9e4a5bb29dbcbc051b399b78e5c6"
source = "git+https://github.com/pimalaya/cli#313c2e999ea9157fa42c84a6ae867451d8308114"
dependencies = [
"anyhow",
"clap",
@@ -2006,9 +2006,9 @@ dependencies = [
[[package]]
name = "rustls-native-certs"
version = "0.8.3"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63"
checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d"
dependencies = [
"openssl-probe",
"rustls-pki-types",
+1 -1
View File
@@ -41,7 +41,7 @@ pimalaya-cli = { version = "0.0.1", default-features = false, features = ["build
anyhow = "1"
base64 = { version = "0.22", optional = true }
chrono = { version = "0.4", default-features = false, features = ["clock"] }
clap = { version = "4.4", features = ["derive", "env", "wrap_help"] }
clap = { version = "4.4", features = ["derive", "wrap_help"] }
comfy-table = "7"
convert_case = { version = "0.11", optional = true }
crossterm = { version = "0.29", default-features = false, features = ["serde"] }
+1 -1
View File
@@ -180,7 +180,7 @@ A persistent configuration is loaded from the first valid path among:
These are the same paths the [himalaya-tui](https://github.com/pimalaya/himalaya-tui) TUI looks at: one TOML file backs both binaries. CLI-only fields and TUI-only sections coexist without errors. See [config.sample.toml](./config.sample.toml) for a documented template.
Override the path with `-c <PATH>` or `HIMALAYA_CONFIG=<PATH>`; multiple paths can be passed at once, separated by `:`. The first one is the base and the rest are deep-merged on top.
Override the path with `-c <PATH>`; multiple paths can be passed at once, separated by `:`. The first one is the base and the rest are deep-merged on top.
Accounts can be (re)configured later with `himalaya account configure <name>`. The wizard skips discovery in this mode: it reuses the existing values as prompt defaults.
+3 -3
View File
@@ -6,9 +6,9 @@
# - $HOME/.config/himalaya/config.toml
# - $HOME/.himalayarc
#
# Override with `himalaya -c <PATH>` or `HIMALAYA_CONFIG=<PATH>`. Multiple paths
# can be passed at once, separated by `:`; the first one is the base and the
# rest are deep-merged on top of it.
# Override with `himalaya -c <PATH>`. Multiple paths can be passed at once,
# separated by `:`; the first one is the base and the rest are deep-merged on
# top of it.
#
# Run `himalaya` once with no config file to launch the wizard, which discovers
# IMAP/SMTP/JMAP defaults via PACC, Thunderbird Autoconfiguration and RFC 6186
+5 -16
View File
@@ -21,9 +21,8 @@ use anyhow::{Result, bail};
use clap::{CommandFactory, Parser, Subcommand};
use pimalaya_cli::{
clap::{
args::{AccountFlag, JsonFlag, LogFlags},
args::{AccountFlag, ConfigFlags, JsonFlag, LogFlags},
commands::{CompletionCommand, ManualCommand},
parsers::path_parser,
},
long_version,
printer::Printer,
@@ -45,8 +44,8 @@ use crate::{
backend::Backend,
config::Config,
shared::{
attachments::cli::AttachmentCommand, client::EmailClient, envelopes::cli::EnvelopeCommand,
flags::cli::FlagCommand, mailboxes::cli::MailboxCommand, messages::cli::MessageCommand,
attachment::cli::AttachmentCommand, client::EmailClient, envelope::cli::EnvelopeCommand,
flag::cli::FlagCommand, mailbox::cli::MailboxCommand, message::cli::MessageCommand,
},
wizard,
};
@@ -60,18 +59,8 @@ pub struct Cli {
#[command(subcommand)]
pub cmd: Command,
/// Override the default configuration file path.
///
/// The given paths are shell-expanded then canonicalized (if
/// applicable). If the first path does not point to a valid file,
/// the wizard will propose to assist you in the creation of the
/// configuration file. Other paths are merged with the first one,
/// which allows you to separate your public config from your
/// private(s) one(s). Multiple paths can also be provided by
/// delimiting them with `:` (like `$PATH` in a POSIX shell).
#[arg(short, long = "config", global = true, env = "HIMALAYA_CONFIG")]
#[arg(value_name = "PATH", value_parser = path_parser, value_delimiter = ':')]
pub config_paths: Vec<PathBuf>,
#[command(flatten)]
pub config: ConfigFlags,
#[command(flatten)]
pub account: AccountFlag,
/// Force a specific backend for cross-protocol commands.
+1 -1
View File
@@ -24,7 +24,7 @@ use pimalaya_cli::printer::{Message, Printer};
use crate::{
imap::{client::ImapClient, mailbox::arg::MailboxNameArg},
shared::messages::arg::MessageArg,
shared::message::arg::MessageArg,
};
/// Save a message to a mailbox.
+1 -1
View File
@@ -32,7 +32,7 @@ use crate::{
client::{JmapClient, jmap_http_auth},
error::format_set_error,
},
shared::messages::arg::MessageArg,
shared::message::arg::MessageArg,
};
/// Import an RFC 5322 message into a mailbox (upload + Email/import).
+1 -1
View File
@@ -25,7 +25,7 @@ use serde::Serialize;
use crate::{
m2dir::{arg::M2dirNameFlag, client::M2dirClient},
shared::messages::arg::MessageArg,
shared::message::arg::MessageArg,
};
/// Save a message to an m2dir folder.
+1 -1
View File
@@ -29,7 +29,7 @@ use crate::{
client::MaildirClient,
flag::arg::FlagArg,
},
shared::messages::arg::MessageArg,
shared::message::arg::MessageArg,
};
/// Save a message to a mailbox.
+1 -1
View File
@@ -47,7 +47,7 @@ fn main() {
fn execute(cli: Cli, printer: &mut StdoutPrinter) -> Result<()> {
Logger::try_init(&cli.log)?;
let config = cli.config_paths.as_ref();
let config = cli.config.paths.as_ref();
let account = cli.account.name.as_deref();
let backend = cli.backend;
cli.cmd.execute(printer, config, account, backend)
@@ -21,7 +21,7 @@ use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{
attachments::{download::AttachmentDownloadCommand, list::AttachmentListCommand},
attachment::{download::AttachmentDownloadCommand, list::AttachmentListCommand},
client::EmailClient,
};
@@ -28,9 +28,9 @@ use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{
attachments::list::{Attachment, AttachmentColors, Attachments, mime_string},
attachment::list::{Attachment, AttachmentColors, Attachments, mime_string},
client::EmailClient,
mailboxes::arg::MailboxArg,
mailbox::arg::MailboxArg,
};
/// Download specific attachments of a single message to disk.
@@ -26,7 +26,7 @@ use pimalaya_cli::printer::Printer;
use serde::Serialize;
use crate::account::context::Account;
use crate::shared::{client::EmailClient, mailboxes::arg::MailboxArg};
use crate::shared::{client::EmailClient, mailbox::arg::MailboxArg};
/// List the attachments carried by a single message in the active
/// account.
@@ -22,7 +22,7 @@ use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
envelopes::{list::EnvelopeListCommand, search::EnvelopeSearchCommand},
envelope::{list::EnvelopeListCommand, search::EnvelopeSearchCommand},
};
/// Shared API to manage envelopes for the active account.
@@ -27,7 +27,7 @@ use pimalaya_cli::printer::Printer;
use serde::Serialize;
use crate::account::context::Account;
use crate::shared::{client::EmailClient, mailboxes::arg::MailboxArg};
use crate::shared::{client::EmailClient, mailbox::arg::MailboxArg};
/// List envelopes for the active account, regardless of the underlying
/// backend (IMAP, JMAP or Maildir).
@@ -26,8 +26,8 @@ use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
envelopes::list::{EnvelopeColors, Envelopes, FlagChars},
mailboxes::arg::MailboxArg,
envelope::list::{EnvelopeColors, Envelopes, FlagChars},
mailbox::arg::MailboxArg,
};
/// Search envelopes for the active account using the shared search
@@ -26,8 +26,8 @@ use serde::Serialize;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
flags::arg::{FlagsArg, MessageIdsArg},
mailboxes::arg::MailboxArg,
flag::arg::{FlagsArg, MessageIdsArg},
mailbox::arg::MailboxArg,
};
/// Add flag(s) to message(s) for the active account.
@@ -22,7 +22,7 @@ use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
flags::{add::FlagAddCommand, remove::FlagRemoveCommand, set::FlagSetCommand},
flag::{add::FlagAddCommand, remove::FlagRemoveCommand, set::FlagSetCommand},
};
/// Shared API to manage flags for the active account.
@@ -26,8 +26,8 @@ use serde::Serialize;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
flags::arg::{FlagsArg, MessageIdsArg},
mailboxes::arg::MailboxArg,
flag::arg::{FlagsArg, MessageIdsArg},
mailbox::arg::MailboxArg,
};
/// Remove flag(s) from message(s) for the active account.
@@ -26,8 +26,8 @@ use serde::Serialize;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
flags::arg::{FlagsArg, MessageIdsArg},
mailboxes::arg::MailboxArg,
flag::arg::{FlagsArg, MessageIdsArg},
mailbox::arg::MailboxArg,
};
/// Replace flag(s) of message(s) for the active account.
@@ -20,7 +20,7 @@ use clap::Subcommand;
use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{client::EmailClient, mailboxes::list::MailboxListCommand};
use crate::shared::{client::EmailClient, mailbox::list::MailboxListCommand};
/// Shared API to manage mailboxes for the active account.
///
@@ -26,8 +26,8 @@ use serde::Serialize;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
flags::arg::FlagArg,
messages::{
flag::arg::FlagArg,
message::{
arg::MessageArg,
handler::{self, Outcome},
},
@@ -22,7 +22,7 @@ use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
messages::{
message::{
add::MessageAddCommand, compose::MessageComposeCommand, copy::MessageCopyCommand,
forward::MessageForwardCommand, mv::MessageMoveCommand, read::MessageReadCommand,
reply::MessageReplyCommand, send::MessageSendCommand,
@@ -24,7 +24,7 @@ use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
messages::{
message::{
builder::{self, BuilderArgs},
handler,
},
@@ -20,7 +20,7 @@ use clap::Parser;
use pimalaya_cli::printer::{Message, Printer};
use crate::account::context::Account;
use crate::shared::{client::EmailClient, flags::arg::MessageIdsArg};
use crate::shared::{client::EmailClient, flag::arg::MessageIdsArg};
/// Copy message(s) from one mailbox to another within the active
/// account.
@@ -24,7 +24,7 @@ use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
messages::{
message::{
builder::{self, BuilderArgs, PostingStyle, SourceArgs, SourceMode},
handler,
},
@@ -20,7 +20,7 @@ use clap::Parser;
use pimalaya_cli::printer::{Message, Printer};
use crate::account::context::Account;
use crate::shared::{client::EmailClient, flags::arg::MessageIdsArg};
use crate::shared::{client::EmailClient, flag::arg::MessageIdsArg};
/// Move message(s) from one mailbox to another within the active
/// account.
@@ -24,7 +24,7 @@ use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
messages::{
message::{
builder::{self, BuilderArgs, PostingStyle, SourceArgs, SourceMode},
handler,
},
@@ -22,7 +22,7 @@ use pimalaya_cli::printer::Printer;
use crate::account::context::Account;
use crate::shared::{
client::EmailClient,
messages::{arg::MessageArg, handler},
message::{arg::MessageArg, handler},
};
/// Send a message via the active account.
+5 -5
View File
@@ -16,9 +16,9 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#[cfg(any(feature = "imap", feature = "jmap", feature = "maildir"))]
pub mod attachments;
pub mod attachment;
pub mod client;
pub mod envelopes;
pub mod flags;
pub mod mailboxes;
pub mod messages;
pub mod envelope;
pub mod flag;
pub mod mailbox;
pub mod message;
+1 -1
View File
@@ -26,7 +26,7 @@ use io_smtp::rfc5321::types::{
use mail_parser::{Addr, Address, HeaderName, HeaderValue, MessageParser};
use pimalaya_cli::printer::{Message, Printer};
use crate::{shared::messages::arg::MessageArg, smtp::client::SmtpClient};
use crate::{shared::message::arg::MessageArg, smtp::client::SmtpClient};
/// Send a raw RFC 5322 message via SMTP.
///