Customize attachment download directory at CLI and env levels
Hello,
Himalaya is a neat little program.
It would be nice if himalaya attachment download worked something like
$ himalaya -o json attachment download 22832
{"22832": [{"name": "A.pdf", "location": "~/Downloads/A.pdf"}]}
instead of
$ himalaya -o json attachment download 22832
"Downloaded 1 attachment!\n"
to allow one to write scripts leveraging himalaya and jq that process email attachments[^1].
I have very limited Rust experience, but I'd be happy to take a look at putting a change together for this.
[^1]: My specific use case is fairly simple. I just need to download and re-send attachments in a different email. I'm trying to use Himalaya to replace much of a Python script used to ease the tedium of filing health insurance claims: https://git.sr.ht/~ani/email-automation/tree/main/item/bcbs_claim_mailer.py.
Seconded, but also to be able to either define the target directory as part of the attachments command, or at the least respect XDG_DOWNLOAD_DIR rather than just the account config.
Right now the only option to differentiate downloads between envelopes from a script seem to be to generate the config for every attempt, and that's .. less than ideal.
Regarding the JSON output of the attachment download command, I would advise to subscribe to #547. I will extend its scope.
Regarding the download directory, I agree to make it customizable both at CLI level via a new argument and at env level with XDG_DOWNLOAD_DIR. That said, XDG_DOWNLOAD_DIR should already work, but only in case you don't define a custom directory in your config. Something smarter could be done: take arg first, then env, then finally config. Let's keep this issue for that particular purpose.
Thank you for your both feedbacks!