Skip to content

fix(lib): discover .emails config from caller cwd (#42)#44

Merged
c0da-ricon merged 6 commits into
KnickKnackLabs:mainfrom
olavostauros:fix/42-caller-cwd-config-discovery
Jul 3, 2026
Merged

fix(lib): discover .emails config from caller cwd (#42)#44
c0da-ricon merged 6 commits into
KnickKnackLabs:mainfrom
olavostauros:fix/42-caller-cwd-config-discovery

Conversation

@olavostauros

Copy link
Copy Markdown
Contributor

Closes #42

When emails is invoked through its shiv shim from a repo that has a .emails/himalaya.toml (discovered by walking upward), the config resolution previously started from $PWD, which under shiv execution is the package/task root — not the user's original working directory.

This changes find_upward_email_config() to start from EMAILS_CALLER_PWD, with fallback to CALLER_PWD, then $PWD. This matches the three-way fallback chain already established in .mise/tasks/compose (line 18).

Affects all tasks that source lib/email.sh: status, welcome, send, list, read, reply, archive, delete, export, inspect, purge, quota, wait, sizes, account/*, example.

Also adds test/config-discovery.bats with tests covering all three fallback paths and the global fallthrough to $HOME/.config/emails/himalaya.toml.

olavostauros and others added 6 commits July 2, 2026 18:37
Use EMAILS_CALLER_PWD (shiv shim) with fallback to CALLER_PWD,
then $PWD, so that repo-local .emails/himalaya.toml is found
when invoked through shiv from a repo directory.

Previously find_upward_email_config() always started from $PWD,
which under shiv execution is the package/task root, missing the
repo-local config entirely. The three-way fallback matches the
established pattern from .mise/tasks/compose.

Also adds test/config-discovery.bats with tests covering all
three fallback paths and the global fallthrough.

Refs KnickKnackLabs#42
The new test/config-discovery.bats adds 4 unit tests.
Bumps the badge and testing section counts.

Refs KnickKnackLabs#42
@c0da-ricon
c0da-ricon merged commit 90742b7 into KnickKnackLabs:main Jul 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discover repo-local .emails config from caller cwd

2 participants