Closed jorgebucaran closed 3 years ago
The issue extends beyond fish_prompt.fish
to any file that might be contained in two plugins. Suppose plugin A uses a dependency called left-pad.fish
, and plugin B does as well. When B is installed, what happens to left-pad.fish
? When A is removed, does it remove left-pad.fish
and leave B inoperable?
Two potential approaches:
View a plugin plus all of its dependencies as a set of files. At install time, test the plugin-to-be-installed's set against the sets of installed plugins. If there is any overlap, abort the user to tell them about it. (To protect against the test case you mentioned, you really need to test the plugins being installed against each other.)
Install each plugin to a separate directory, and use $fish_function_path
as an overlay as mentioned on the other thread. Even there, there are still determinism issues around the ordering of plugins on $fish_function_path
, so you'd likely want to warn users.
When B is installed, what happens to left-pad.fish? When A is removed, does it remove left-pad.fish and leave B inoperable?
Fish doesn't have other scope but global, so a good plugin will use a prefix like _foobar_
to "scope" functions and variables.
Even using the overlay approach, (fyi that's how Fisher 1.x used to work), you'd still run into the same issue I described above where Tide's fish_right_prompt
would coexist with Lucid's fish_prompt
, thus you'd still want to uninstall Tide before installing Lucid. There's a precedent for that as well in Fisher 1.x and 2.x, but I am not sure if I want to bring that back.
I'm not sure as to this specific scenario, but in general I'd say it's okay to let users screw their configuration up with bad choices. Protecting the user from every issue that could arise will cause massive code expansion. This case is fairly common though so idk.
Closing for the same reason given in #638.
No, it's not really possible to use multiple prompts at the same time, but what happens if you do this:
Fisher will install Tide, then Lucid. Problem? Yes.
This is not usually an issue, because a good plugin will use a prefix like
_foobar_
to "scope" functions and variables, but some special functions likefish_prompt
,fish_right_prompt
, etc., can't be named that way. This issue is clear for prompts. Above, when Lucid is installed, Lucid'sfish_prompt.fish
will overwrite Tide'sfish_prompt.fish
. What's even worse, Tide'sfish_right_prompt
will coexist with Lucid'sfish_prompt
!The solution is, of course, to uninstall Tide before installing Lucid, and vice-versa (or when installing any prompt). The issue is, however, should we uninstall the current prompt by default when installing a new prompt? Should we not let you?
Checking if a plugin is probably a prompt is easy enough: