himalaya icon indicating copy to clipboard operation
himalaya copied to clipboard

Customize attachment download directory at CLI and env levels

Open butterthebuddha opened this issue 1 year ago • 2 comments

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.

butterthebuddha avatar Feb 09 '25 21:02 butterthebuddha

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.

letoram avatar Feb 12 '25 16:02 letoram

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!

soywod avatar Feb 18 '25 08:02 soywod