~soywod/pimalaya#209: 
Specify himalaya configuration through HIMALAYA_ environment variables.

While there are workarounds that I may implement, it would be really nice if himalaya did support a way to get its configuration file from an environment variable that is not $HOME or $XDG_*. Both these environment variables are coupled to tons of other software, and it would be nice if, when entering a folder, direnv allowed to set the environment variable that specifies the himalaya config path. As this could be construed as unsafe in some context, one may eventually gate that extra behaviour behind a command line flag.

As of today, having had a look at the code, one gets the path only via the CLI or via these broad environment environment variables (HOME, and XDG_*). It's "cli", or "default" in from_paths_or_default. If clap allows easy integration with environment variables, one could put a HIMALAY_ env var in the cli part of the code. If not, the from_paths_or_default is not a really a good name as it's not "default" but "custom".

I'd like to hack it, if only for my own needs. However, if that needs to be pushed upstream, it would be nice to know where some HIMALAYA_ environment variables would fit in between "cli" and "default".

Status
RESOLVED IMPLEMENTED
Submitter
~yziquel
Assigned to
Submitted
a month ago
Updated
a month ago
Labels
No labels applied.

~yziquel a month ago

It seems that this functionality is already in clap:

https://github.com/clap-rs/clap/commit/797b6b3340dd254b3387f453172a396f4c943182

~yziquel a month ago

It seems to be gated behind the "env" feature of clap:

https://docs.rs/clap/latest/clap/_features/index.html

The "env" feature of clap is not enabled, it seems, in himalaya's Cargo.toml.

~yziquel a month ago

I got this working here:

https://github.com/gl-yziquel/himalaya/tree/yziquel

Feel free to comment.

~soywod REPORTED IMPLEMENTED a month ago

Thank you, I really like the idea. Good to know that clap supports it. I just merged your PR, it will be available for the next release!

Register here or Log in to comment, or comment via email.