fix(lib): discover .emails config from caller cwd (#42)#44
Merged
c0da-ricon merged 6 commits intoJul 3, 2026
Merged
Conversation
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
# Conflicts: # README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #42
When
emailsis 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 fromEMAILS_CALLER_PWD, with fallback toCALLER_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.batswith tests covering all three fallback paths and the global fallthrough to$HOME/.config/emails/himalaya.toml.