Customizing Variables
JP-Ellis opened this issue · 2 comments
A number of plugins allow for their functionality to be customized by defining and/or changing environment variables (or using zstyle
).
Whilst it is of course possible to define these after eval $(sheldon source)
, I was wondering whether there might be support for this within the Sheldon config?
Perhaps something like
[plugins]
[plugins.enhancd]
github = "b4b4r07/enhancd"
[plugins.enhancd.variables]
ENHANCD_HOOK_AFTER_CD = "ls"
Which would effectively run
$ sheldon --source
source "~/.local/share/sheldon/repos/github.com/b4b4r07/enhancd/enhancd.plugin.zsh"
ENHANCD_HOOK_AFTER_CD="ls"
If this is a feature that might be useful, I could have a look at implementing it if I get time.
I think this is a great idea, I would be happy to accept a pull request for this change. I think the variable should be set before the plugin is sourced though.
Hi @rossmacarthur, I have been thinking about a pre/post hook feature for sheldon
for some time and it might fit @JP-Ellis 's use case just well.
Here is the idea:
[plugins]
[plugins.enhancd]
github = "b4b4r07/enhancd"
[plugins.enhancd.hooks]
pre = """
# run something before sourcing the plugin
"""
post = """
# run something after the plugin is sourced
export ENHANCD_HOOK_AFTER_CD='ls'
"""
The hook feature seems more generic as it can do more than setting customized variables.
I'd be happy to try submit a pull request if you find this feature useful :)