-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get selected version in plugin event handlers #788
Comments
There isn't an automatic way to grab that info right now, but we could make it happen. We can pass the plugin name and tag in the Lines 190 to 192 in 2efd33c
This way the event handler receives the full plugin name and version tag, as its first argument. For example, if you installed # Defined in flipper/conf.d/flipper.fish
function _flipper_install --on-event flipper_install --argument-names plugin
switch (string split -- @ $plugin)[2]
case v1
...
end
end We can set it up the same way for when you're uninstalling a plugin here: Lines 134 to 136 in 2efd33c
What you could do is modify Fisher as I've outlined and see if that works for you. I'm open to adding this in. It's a minimal change, and I've been waiting for a good reason to use event parameters more effectively. 👍 |
You can try it via jorgebucaran/fisher@event-args now. |
Thanks for the quick and detailed response! 💛 TL;DR It works, but now when I'm thinking about it, would it be possible to invoke I patched my local Considering that plugin developers would have to wait for users to upgrade their version of I believe this would achieve the same thing for installs, but for upgrades it looks like the |
Developers would still need to wait, since there is no Your initial idea seems to align more naturally with automating things, which I think suits our needs better for this context. But, like you said, ensuring all users update to the latest Fisher version takes time. In the meantime, you might consider traversing the internal |
I'm not sure what you mean by this, since I can run Anyway, getting the plugin name as an argument would indeed be better, and potentially iron out some weird edge cases (e.g. my code would fail if someone would have two different versions of the plugin installed). So /lgtm 🙈 |
I was referring to |
Quick update. I've removed this issue from the 5.0 milestone because, on second thought, there doesn't seem to be a need for a new major release for this. A minor release should be enough. In hindsight, I was probably being too cautious. I know you might not need this anymore, but I've kind of grown fond of the idea and want to explore it further. This is non-critical, so I'll just keep it open, but I like it. |
When designing a plugin which can be installed with
fisher
, you can add event handlers inconf.d
which get invoked byfisher
when the user installs, updates and removes your plugin.This is great, and I want to leverage these event handlers to install dependencies for my plugin. However, the version of these dependencies may vary depending on which version of the plugin is being installed, but I cannot see any mechanism in
fisher
for getting the version of the plugin being installed. For example, if the user runsfisher install some/plugin@v1
I would like to getv1
as an argument somewhere.Is this possible?
The text was updated successfully, but these errors were encountered: