rossmacarthur / sheldon

:bowtie: Fast, configurable, shell plugin manager
https://sheldon.cli.rs
Apache License 2.0
958 stars 21 forks source link

Aliases set by plugin cannot be executed from other plugins #174

Open celclow opened 5 months ago

celclow commented 5 months ago

It seems that aliases set by a plugin cannot be executed by other plugins. Since functions can be executed, I would expect aliases to be similarly executable.

plugins.toml

shell = "zsh"

[plugins]

[plugins.foo]
local = "~/foo"

[plugins.foo.hooks]
post = "aliastest ; functest"

[plugins.bar]
inline = "aliastest ; functest"

~/foo/foo.zsh

alias aliastest="echo aliastest"
functest() {echo "functest"}

Login log functest can be executed from hooks.post and other plugins, whereas aliastest cannot be executed.

Last login: Tue Jan 23 13:23:34 on ttys001
(eval):2: command not found: aliastest # foo.hooks.post aliastest
functest                               # foo.hooks.post functest
(eval):3: command not found: aliastest # bar.inline aliastest
functest                               # bar.inline functest
% aliastest
aliastest
% functest
functest

zsh version: zsh 5.9 (x86_64-apple-darwin23.0) sheldon version: sheldon 0.7.4

rossmacarthur commented 5 months ago

I'm still investigating why this doesn't work properly, but you can work around it for now by doing the following:

Instead of this

eval "$(sheldon source)"

Use

source <(sheldon source)
celclow commented 5 months ago

Thanks for the reply. The workaround you provided worked as expected. I appreciate your help.